Every repository with this icon (
Every repository with this icon (
| Description: | A Ruby Gem that gives you full access to several of the Amazon Web Services API from your Ruby/Ruby on Rails apps edit |
-
create_autoscaling_group failing - Unexpected list element termination
4 comments Created about 1 month ago by arfonI'm having trouble getting the create_autoscaling_group command working properly:
@as = AWS::Autoscaling::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) @as.create_autoscaling_group( :autoscaling_group_name => "MyScalingGroup", :availability_zones => "us-east-1a", :load_balancer_names => "MyLb", :launch_configuration_name => "MyLaunchConfig", :min_size => 1, :max_size => 3)Whatever I do I can't get the :load_balancer_names parameter to work properly. Could someone please provide a working example? The above doesn't work!
Cheers
ArfonComments
-
Can't get the Gem Working with Mac OS X Snow Leopard: no such file to load -- EC2
4 comments Created about 1 month ago by ncriAfter installing the gem,
require 'EC2'
gives an error: LoadError: no such file to load -- EC2
Comments
You should require 'AWS'. This changed a few months ago when the library started acquiring additional AWS API's. I did find a spot in the README.rdoc which needed to be changed to reflect this though.
http://github.com/grempe/amazon-ec2/commit/7a9322b78cc5a2a123884c50999d0543909c1835
Thanks.
Thanks! Yes, would be very helpful to mention this somewhere. Also that
config.gem "amazon-ec2", :lib => "EC2" has to be changed to "amazon-ec2", :lib => "AWS"Yes, if you look at the commit I linked to in my last message you will see I already changed it. :-) And the example code packaged with the lib already used require AWS for some time now... Cheers.
-
terminate_instances documented as array, but wants string
1 comment Created about 1 month ago by joshuanapoliterminate_instances is documented with "# @option options [Array] :instance_id ([])", but
instances = [ "ami-xxxxxxxx", "ami-yyyyyyyy" ] ec2.terminate_instances( { :instance_id => instances } )
gives an error. On the other hand, this works fine:
ec2.terminate_instances( { :instance_id => "ami-xxxxxxxx" } )
Comments
Hi. You didn't specify what error you were receiving. I did notice that you appear to be providing AMI IDs 'ami-xxx' instead of instance ID's 'i-xxx' in your example. Was that just a typo?
In any case, I just ran an interactive session where I started two instances, verified they were running, and then terminated both of them by passing in the array of instance ID's to terminate_instances, and verify they both terminated.
You can see it here:
So unless you can provide some additional information on the failure you are seeing, with as much detail as possible, I'll close this one for now as 'works for me'. Thanks for the report though, please refile if you find a specific case that fails (although please note that the code for handling methods that accept arrays is shared across all such methods in the library, so there is likely nothing that would apply to one such method and not another).
-
Hola grempe,
When trying to attache a load balancer to an already defined instance, I get the ungodly error message:
[#<Net::HTTPBadRequest 400 Bad Request readbody=true>, #<Net::HTTP::Post POST>, "AWSAccessKeyId=XXXXXXXXXXXX&Action=RegisterInstancesWithLoadBalancer&Instances.member.1=i-ab63b5c3&LoadBalancerName=balancer&SignatureMethod=HmacSHA1&SignatureVersion=2&Timestamp=2009-09-24T01%3A11%3A34Z&Version=2009-05-15&Signature=XXXXX"]
AWS.rb:267:in
aws_error?': undefined methodelements' for nil:NilClass (NoMethodError)
Comments
I am forwarding this issue to 'krisr' who wrote most of the ELB related code to see if he has any ideas why a nil object would be coming back. Can you tell us whether the command seems to have any effect regardless of the error that comes back? Or does it fail consistently?
Hmm, I'm still using an earlier version of the gem from just after Grempe first merged my changes and never hit this issue.
It sounds like the body of the response from amazon is empty and as a result the document.root is nil. We can update AWS.rb so that it deals with this more gracefully but I'd still like to figure out why all your calls are failing. I'll update to the latest version of the gem tomorrow and run some tests.
I updated to the latest gem and I'm not able to reproduce this issue. Are you able to launch instances or use any other parts of the API beyond the ELB support?
I seem to be having the same problem. I pulled down the development trunk where it handles it gracefully. This is the response coming back from amazon when I try to register an instance.
Request Params:
AWSAccessKeyId=XXXXXXXXXXXXXXXXXXXX&Action=RegisterInstancesWithLoadBalancer&Instances.member.1=i-XXXXX&LoadBalancerName=XXXX-elb&SignatureMethod=HmacSHA1&SignatureVersion=2&Timestamp=2009-10-07T12%3A23%3A11Z&Version=2009-05-15&Signature=XXXXXXXXXXXXXXXXXXXXXX%3D
Raw Response:
<Error> <Type>Sender</Type> <Code>MalformedInput</Code> <Message>Unexpected complex element termination</Message> </Error> <RequestId>ec4b17dd-XXX-XXX-XXXX-XXXXXXXXXXXX</RequestId> </ErrorResponse>I have (had) this issue as well. I tracked it down to a malformed request. Open AWS/ELB/load_balancers.rb and change line 91 to read:
params.merge!(pathhashlist('Instances.member', options[:instances].flatten.collect{|e| {:instance_id => e}}, {:instance_id => 'InstanceId'}))I pushed a potential fix for this issue (thanks for the patch alebsack!). Please check out the commit:
http://github.com/grempe/amazon-ec2/commit/5c6c3f7e6cd0fe8976f06be084b7441b9eda398e
And please clone the repo and install the gem locally and let me know if this resolves this issue. I don't currently use ELB so please report if it is ok when used in real life. If I get some +1's I'll push it as a new release.
I'll give this a test as well, thanks for fixing it grempe! It's interesting that it's been working for me without this change - only thing i can think of is that I might have only ever been registering one instance at a time.
Happily I received a few +1's on this fix. New gem generated and pushed to gemcutter.
http://gemcutter.org/gems/amazon-ec2/versions/0.6.2
Closing.
-
Hi,
I installed the 5.5.0 gem using the github source (grempe-amazon-ec2 (0.5.5))
I am trying to create an ELB using the gem.
ec2sh
@elb.describe_load_balancers AWS::Error: The requested version (2009-05-15) of service AmazonEC2 does not exist
Is this a bug or a mistake on my part? I found a post here:
http://developer.amazonwebservices.com/connect/thread.jspa?messageID=139714
But can't understand what should I change.
My apologies in advance if this is not a bug.
Comments
Can you please post this in the google group as well (the link is in the readme). You can also reach out to Kris Rasmussen (krisr on github) who recently merged this functionality in. Perhaps he can help us get to the bottom of your issue. Thx.
Works for me. Are you still seeing this behavior?
>> @elb.describe_load_balancers => {"DescribeLoadBalancersResult"=>{"LoadBalancerDescriptions"=>nil}, "ResponseMetadata"=>{"RequestId"=>"70784a0f-a666-11de-8ed7-e59c6e1990c6"}, "xmlns"=>"http://elasticloadbalancing.amazonaws.com/doc/2009-05-15/"} -
2 comments Created 8 months ago by funadviceImproper require statement in one of the examplesdocumentationxIn an example you have:
require 'ec2'It should be in upper-case:
require 'EC2'Tore out my non-existent hair until I figured it out. Great work!
Comments












Hi Arfon,
First, you might want to post this to the Google Group (address is in the readme).
In any case, please note that the autoscaling functionality was submitted as a patch and so I have not tested it against the live service myself. That being said:
Please report back if you have any success or figure it out. If not you should post your issue and sample code to the google group. If something is broken (including the docs) patches are gladly accepted.
Thanks for the reply. I'm pretty sure I've got everything right. I'll try posting to the Google Group.
Cheers
Arfon
I just pushed a potential fix for this:
http://github.com/grempe/amazon-ec2/commit/193bdd90aa6f08f00bdc4ed5fa7a8c942e38ac3a
Can you please clone the repo, and build the gem locally from the 'elb-fix' branch and install that in place of the gem on your system now. Please test it, passing in the load balancer names as an array of strings (even if just a single LB name).
Once cloned you should be able to build and install it with:
sudo gem uninstall amazon-ec2
git checkout elb-fix
rake gemspec
rake build
rake install
Let me know how that goes for you and if it works now I will merge that to master and push a new official version for you to use.
Cheers,
Glenn
Based on good feedback on testing a fix for this I have pushed version 0.7.3 of the gem that includes the fix.