Skip to content

Instantly share code, notes, and snippets.

@kidbrax

kidbrax/get-ami.sh

Created Jan 24, 2018
Embed
What would you like to do?
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