Hashicorp Packer files for creating a METplus AMI for the METplus 2022 Hackathon
# Define the required variables in a file
$ cat << EOF > vars.auto.pkrvars.hcl
subnet_id = "subnet-id"
security_group_ids = [
"sg-id1", # inbound SSH access from where Packer is being run
"sg-id2", # outbound access to the internet
]
tags = {
"tag1" = "value1"
"tag2" = "value2"
}
EOF
$ packer init .
$ packer validate .
$ packer fmt .
$ packer build metplus.pkr.hclThe build will take roughly an hour to download and configure everything.
You will need to do some further setup to install METplus and configure the conda environment for both users. A sample user-data.sh script is provided in the root of the repo for this purpose. It can be used to configure new instances at launch time.
A variable file named like so vars.auto.pkrvars.hcl will be auto loaded by Packer.
Pass -var-file= to use a different variable file to e.g. - target different accounts.
This installation assumes:
- MET is installed in
/opt/metwith system python embedding - 2 non-admin users (
user1&user2) in the AMI- Both users are part of the
hackathongroup - The rest of the METplus suite installed in $HOME
- Miniconda set up for each user
- A custom conda environment enabled by default
MET_PYTHON_EXEset to miniconda python- vim, nano, emacs are installed and X11 forwarding is enabled
- A shared workspace in
/hackathon-scratchwith an ACL set so new files are read/writeable by thehackathongroup
- Both users are part of the
- S2S sample data installed in
/metplus-datafrom: https://dtcenter.ucar.edu/dfiles/code/METplus/METplus_Data/v4.1/sample_data-s2s-4.1.tgz- more sample data can be found here: https://dtcenter.ucar.edu/dfiles/code/METplus/METplus_Data/v4.1/
- The OLR and various BDP datasets mounted in
/metplus-data/hackathon