Module: OngrDeploy::Aws

Defined in:
lib/ongr_deploy/aws.rb

Instance Method Summary collapse

Instance Method Details

#autoscale(name, *args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ongr_deploy/aws.rb', line 7

def autoscale( name, *args )
  ::Aws.config.update(
    {
      region:      fetch( :aws_region ),
      credentials: ::Aws::Credentials.new( fetch( :aws_id ), fetch( :aws_secret ) )
    }
  )

  ec2_client       = ::Aws::EC2::Client.new
  autoscale_client = ::Aws::AutoScaling::Client.new

  autoscale = ::Aws::AutoScaling::AutoScalingGroup.new name, autoscale_client

  autoscale.instances.each do |i|
    instance = ::Aws::EC2::Instance.new i.id, client: ec2_client

    server instance.private_ip_address, *args
  end
end