Skip to content

Instantly share code, notes, and snippets.

@kidbrax
Created January 24, 2018 04:00
Show Gist options
  • Save kidbrax/5df5b37cc30797b87401d8095621f929 to your computer and use it in GitHub Desktop.
Save kidbrax/5df5b37cc30797b87401d8095621f929 to your computer and use it in GitHub Desktop.
Get ID of AMI created using Packer
# assuming you use a manifest file such as:
# "post-processors": [
# {
# "type": "manifest",
# "output": "manifest.json",
# "strip_path": true
# }
# ]
new_ami_id=$(cat manifest.json | jq -r '.builds | .[length-1].artifact_id' | cut -d ':' -f 2)
echo "New AMI is $new_ami_id"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment