Sha256: b23ccd642b9232a0b6584c4d28da9068054898107c4ee86aa5cf384efe75b636
Contents?: true
Size: 574 Bytes
Versions: 3
Compression:
Stored size: 574 Bytes
Contents
module AwsEc2::TemplateHelper::AmiHelper include AwsEc2::AwsServices # Example: # # latest_ami("ruby-2.5.0_*") => ami-122 # # Equivalent aws cli test command: # # $ aws ec2 describe-images --owners self --filters="Name=name,Values=ruby-2.5.0_*" | jq '.Images | length' # # Returns latest ami ami def latest_ami(query, owners=["self"]) images = ec2.describe_images( owners: owners, filters: [ {name: "name", values: [query]} ] ).images image = images.sort_by(&:name).reverse.first image.image_id end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
aws-ec2-0.5.1 | lib/aws_ec2/template_helper/ami_helper.rb |
aws-ec2-0.5.0 | lib/aws_ec2/template_helper/ami_helper.rb |
aws-ec2-0.4.0 | lib/aws_ec2/template_helper/ami_helper.rb |