Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aws::AutoScaling::Client#create_auto_scaling_group yielding Seahorse::Client::NetworkingError #966

Closed
cmhobbs opened this issue Oct 19, 2015 · 4 comments

Comments

@cmhobbs
Copy link

cmhobbs commented Oct 19, 2015

I am able to use aws-sdk to create Autoscale groups if I supply an EC2 instance with the instance_id option. However, when I attempt to create one using a launch config (launch_configuration_name) and the vpz_zone_identifier, I'm met with the following error:

Seahorse::Client::NetworkingError: getaddrinfo: Name or service not known
from /home/christopher/.rbenv/versions/2.2.2/lib/ruby/2.2.0/net/http.rb:879:in `initialize'

Here's a loose example of how I get the above error:

service = Aws::AutoScaling::Client.new({ region: us-west-2 })

autoscaling_options = {
 :routing_id => "test", 
 :routing_target => "test",
 :region => "us-west-2a",
 :access_key_id => "NOPE",
 :secret_access_key => "NOPE",
 :name => "SampleGroup",
 :launch_configuration_name => "SampleCOnfig",
 :vpc_zone_identifier => "subnet-XXXXXXXX",
 :min_size => 1,
 :max_size => 1,
 :tags => [{:key=>"Foo", :value=>"Bar", :propagate_at_launch=>true}]
}

service.create_auto_scaling_group(autoscaling_options)

Note that omitting launch_configuration_name and vpc_zone_identifier and adding instance_id with a valid EC2 instance ID works perfectly.

Fearing an issue with my options, I successfully created an Autoscale group via the web console and picked out the parameters it sent back to the server. I then plugged those parameters into the same code above and was met with the exact same error.

I then attempted to use curl with both the above parameters and the ones I extracted to try to create an Autoscale group via the endpoints documented here: http://docs.aws.amazon.com/general/latest/gr/rande.html#as_region

Those endpoints sent me in a loop of 302 and 301 redirect codes, which eventually landed me on the main sales page for the Autoscaling service.

Unless I misread the source, the library uses http://autoscaling.amazonaws.com/doc/2011-01-01/ as an endpoint. When I tried to use curl here, I was met with 404's and <UnknownOperationException/> errors regardless of the payload I sent it.

Any input you guys can provide would be awesome! Thanks!

@trevorrowe
Copy link
Member

The issue is in your configuration. You specify the region with :region => "us-west-2a". This is the name of an availability zone, not a region. Try replacing this with us-west-2 and the networking error should go away. This happens because the region name is used to construct an endpoint, in this case ec2.us-west-2a.amazonaws.com, which is not a valid cname.

@trevorrowe
Copy link
Member

Since this was the second or third issue I've seen raised by users that were confused by the unhelpful error message returned from the networking stack, I've added some validation that will reject the region if it is an availability zone. This will go out with our next release. Thanks for reporting this issue.

@cmhobbs
Copy link
Author

cmhobbs commented Oct 19, 2015

Well, that appears to have been the issue. I'm glad it was something simple like this.

Is this documented anywhere or is there any chance of getting better error messages? This corner of the libarary is a labrynth of metaprogramming. It was rough trying to track down a potential source.

@cmhobbs
Copy link
Author

cmhobbs commented Oct 19, 2015

Great, thanks!

awood45 added a commit that referenced this issue Oct 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants