Sha256: cb0aa283107cab4fe07d7306a3aa3c2439b92432f657e60c4405eadf88c22552
Contents?: true
Size: 995 Bytes
Versions: 4
Compression:
Stored size: 995 Bytes
Contents
require 'aws-sdk-v1' module Ec2ssh class Ec2Instances attr_reader :ec2s, :aws_keys def initialize(aws_keys, regions) @aws_keys = aws_keys @regions = regions end def make_ec2s AWS.start_memoizing _ec2s = {} aws_keys.each do |name, key| _ec2s[name] = {} @regions.each do |region| options = key.merge ec2_region: region _ec2s[name][region] = AWS::EC2.new options end end _ec2s end def ec2s @ec2s ||= make_ec2s end def instances(key_name) @regions.map {|region| ec2s[key_name][region].instances. filter('instance-state-name', 'running'). to_a. sort_by {|ins| ins.tags['Name'].to_s } }.flatten end def self.expand_profile_name_to_credential(profile_name) provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new(profile_name: profile_name) provider.credentials end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ec2ssh-3.1.1 | lib/ec2ssh/ec2_instances.rb |
ec2ssh-3.1.0 | lib/ec2ssh/ec2_instances.rb |
ec2ssh-3.1.0.rc2 | lib/ec2ssh/ec2_instances.rb |
ec2ssh-3.1.0.rc1 | lib/ec2ssh/ec2_instances.rb |