Skip to content

Instantly share code, notes, and snippets.

@dasgoll
Forked from danrigsby/packer-ami-id
Created May 23, 2017 06:25
Show Gist options
  • Save dasgoll/7432fb6ba53e6b438d7b7918708d2a40 to your computer and use it in GitHub Desktop.
Save dasgoll/7432fb6ba53e6b438d7b7918708d2a40 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment