Is there a utility or script available to retrieve a list of all instances from AWS EC2 auto scale group?
I need a dynamically generated list of production instance
for ruby using aws-sdk gem v2 First create ec2 object as this:
ec2 = Aws::EC2::Resource.new(region: 'region', credentials: Aws::Credentials.new('IAM_KEY', 'IAM_SECRET') )
instances = []
ec2.instances.each do |i|
p "instance id---", i.id
instances << i.id
end
This will fetch all instance ids in particular region and can use more filters like ip_address.