Skip to content

Instantly share code, notes, and snippets.

@danrigsby
Last active December 14, 2023 15:07
Show Gist options
  • Star 91 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save danrigsby/11354917 to your computer and use it in GitHub Desktop.
Save danrigsby/11354917 to your computer and use it in GitHub Desktop.
Get AMI ID from a packer build
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@pawanbahuguna
Copy link

For multiple AWS regions, try:

jq -r '.builds[0].artifact_id' ./manifest.json | tr ',' '\n'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment