Skip to content

Instantly share code, notes, and snippets.

@mak3r
Created January 23, 2020 13:36
Show Gist options
  • Save mak3r/2ec3ad30a0edd32c5f1f1a81ca196777 to your computer and use it in GitHub Desktop.
Save mak3r/2ec3ad30a0edd32c5f1f1a81ca196777 to your computer and use it in GitHub Desktop.
Get the AMI for ubuntu bionic 18.04
#!/bin/sh
# based on this https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html#finding-an-ami-aws-cli
aws ec2 describe-images --owners 099720109477 --filters 'Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-????????' 'Name=state,Values=available' --query 'reverse(sort_by(Images, &CreationDate))[:1].ImageId' --output text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment