Sha256: de60d33f51244ac057dae77ff5548647e57b109bc41bd8e5e2a4e58874b66d30

Contents?: true

Size: 660 Bytes

Versions: 11

Compression:

Stored size: 660 Bytes

Contents

#!/usr/bin/env ruby

# Returns the latest Ubuntu AMI from Canonical.  Change the AMI name
# below to select a different Ubuntu version.  Example run:
#
# $> ./bin/get_latest_ubuntu_ami us-east-2

require "bundler/setup"
require "aws-sdk-ec2"

client = Aws::EC2::Client.new(region: ARGV[0])

result = client.describe_images({
  owners: ['099720109477'],
  filters: [
    {
      name: "name",
      values: ["ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*"]
    },
    {
      name: "virtualization-type",
      values: ["hvm"]
    },
    {
      name: "root-device-type",
      values: ["ebs"]
    }
  ]
})

puts result.images.sort_by(&:name).last.image_id

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
openstax_aws-2.1.0 bin/get_latest_ubuntu_ami
openstax_aws-2.0.1 bin/get_latest_ubuntu_ami
openstax_aws-2.0.0 bin/get_latest_ubuntu_ami
openstax_aws-1.6.1 bin/get_latest_ubuntu_ami
openstax_aws-1.6.0 bin/get_latest_ubuntu_ami
openstax_aws-1.5.0 bin/get_latest_ubuntu_ami
openstax_aws-1.4.0 bin/get_latest_ubuntu_ami
openstax_aws-1.3.0 bin/get_latest_ubuntu_ami
openstax_aws-1.2.0 bin/get_latest_ubuntu_ami
openstax_aws-1.1.0 bin/get_latest_ubuntu_ami
openstax_aws-1.0.0 bin/get_latest_ubuntu_ami