class Comodule::Deployment::Helper::Aws::Ec2::Service

Public Instance Methods

ec2() click to toggle source
# File lib/comodule/deployment/helper/aws/ec2.rb, line 16
def ec2
  @ec2 ||= aws.ec2
end
latest_ami() click to toggle source
# File lib/comodule/deployment/helper/aws/ec2.rb, line 24
def latest_ami
  images = own_images
  if config.ec2 && config.ec2.ami && config.ec2.ami.prefix
    images = images.find_all { |ami| ami.name =~ /^#{config.ec2.ami.prefix}/ }

    filter = -> ami { ami.name.match(/[0-9]*$/)[0].to_i }
    images = images.sort do |a, b|
      filter[b] <=> filter[a]
    end
  end
  images.first
end
own_images() click to toggle source
# File lib/comodule/deployment/helper/aws/ec2.rb, line 20
def own_images
  ec2.images.with_owner('self')
end