Class: Comodule::Deployment::Helper::Aws::Ec2::Service
- Inherits:
-
Object
- Object
- Comodule::Deployment::Helper::Aws::Ec2::Service
- Includes:
- Base
- Defined in:
- lib/comodule/deployment/helper/aws/ec2.rb
Instance Method Summary collapse
Methods included from Base
Instance Method Details
#ec2 ⇒ Object
16 17 18 |
# File 'lib/comodule/deployment/helper/aws/ec2.rb', line 16 def ec2 @ec2 ||= aws.ec2 end |
#latest_ami ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# 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 ⇒ Object
20 21 22 |
# File 'lib/comodule/deployment/helper/aws/ec2.rb', line 20 def own_images ec2.images.with_owner('self') end |