I am using aws-sdk gem
. i want to stop and start aws instance using 'aws-sdk' gem.
Below is my code to start an already stooped amazon instance but it is giving me error as SocketError: getaddrinfo: Name or service not known
ec2 = AWS::EC2::Client.new(
region: 'us-west-2c',
credentials: {:access_key_id => 'XXXXXXXXX',:secret_access_key => 'XXXXXXXXXXX'}
)
resp = ec2.start_instances({
instance_ids: ["i-xxxxxx"],
additional_info: "String"
})
Please help
Thanks,
After a lot of research i came to know that i was specifying wrong region.
My region was 'us-west-2' and i was using region as 'us-west-2c' Which was not a region but availability zone.
After changing region to 'us-west-2' it works