chilts / awssum

(deprecated: use aws-sdk) Node.js modules for talking to lots of Web Service APIs.
Other
461 stars 57 forks source link

CreateAutoScalingGroup.Tags keeps giving me "MalformedInput"-error #50

Closed techtribe closed 12 years ago

techtribe commented 12 years ago

When using the autoscaling endpoint through Awssum, I am not able to create an autoscaling group with tags. I've tried the following options in Awssum:

as.CreateAutoScalingGroup({
         AutoScalingGroupName:'test',
         AvailabilityZones:['eu-west-1a','eu-west-1b','eu-west-1c'],
         LaunchConfigurationName:'testConfiguration',
         MinSize:1,
         MaxSize:3,
         DesiredCapacity:1,
         Tags: (see below)
},this);

where I tried:

Tags: ['Key=Type,Value=API'],
Tags: [{Key:'Type',Value:'API'}], 
Tags: ['k=Type,v=API'], 
Tags: {Key:'Type',Value:'API'},
Tags: 'Key=Type,Value:API', 

but only sometimes it accepts it (object-version), while it will not be added to the group or instances launched. The error is an HTTP:400 - "MalformedInput : Unexpected complex element termination".

I know it is the kind of param-array type, but in other situations with Awssum param-array is working for me while it than has only 1 dimensional params (just a String) while with Tags it has multiple options (key, value, etc).

Could you tell me if there is a bug/issue in the awssum code or an example at awssum/examples/amazon/autoscaling/ ?

Thnx for your time!

Joey

PS: launchCongfiguration is working/available, and when I skip the Tags-param with the above example it will start an autoscaling group.

chilts commented 12 years ago

Hi Joey, :)

Thanks for opening this issue. I've gone through the rest of the AutoScaling docs and updated this and four other parameters so that they'll accept a more complicated data structure rather than just an array of strings which is what I originally had.

Would it be possible for you to try again with master using the following syntax (your 2nd example above):

[{Key:'Type',Value:'API'}],

e.g.

    Tags : [
        {Key:'Type',Value:'API'},
        {Key:'Type',Value:'API'},
        ...
    ]

Also, would it be possible to post back here to confirm everything is working correctly. :) I can't check that at the moment I'm afraid.

Many thanks and thanks for using AwsSum, Andy

techtribe commented 12 years ago

Andy, you are awssum! You are making my day and it is really weird to see that in the documentation online you cannot find a definitive syntax example to identify what I did wrong or how I could find the bug/setup.

Thnx a lot & btw it works with the new master!

chilts commented 12 years ago

Heh, thanks Joey. :)

Anyway, you're the one who found the bug which is probably the hardest thing to do! Anyway, am glad it works.

Yeah, some docs on Amazon's site is great (with examples) but sometimes it is severly lacking. The CloudSearch API is terribly documented and was a right pain, but it's there now. AutoScaling is something I haven't really used so kinda made the API blind, so I'm afraid you're a guinea pig - thanks for pioneering through. :)

By the way, are you using AwsSum in your company and also, are you using it in production? I'd love to get some quotes off companies using it for a new docs site I'm working on. It'll also have lots of examples which hopefully will have things like this on it!

Many thanks for replying so quickly and don't hesitate to open any more issues as you find them.

Thanks again, Andy

techtribe commented 12 years ago

We had some small projects with Node.JS / Awssum (S3-backups) running, but when I have a nice project (with permission) I will let you know about it! No problem being the guinea-pig, while programming AWS can be so much fun,...when it works! ;)

Thanks for helping around with such a complete up-to-date library and I presume will be testing more functions coming months in Awssum.

;)