aws-apps-scripts icon indicating copy to clipboard operation
aws-apps-scripts copied to clipboard

How can I use it to StartInstances

Open maozza opened this issue 4 years ago • 2 comments

How can I use it to StartInstances? what am I doing wrong?

AWS.init("XXXXX", "XXXXXXX);
var i = {
       "InstanceIds": [
        "i-XXXXXX"
      ]
}
var response = AWS.request(
      service='ec2', 
      region='us-east-1',
      action='StartInstances',
      params={"Version":"2015-10-01"}, 
      method='POST',
      payload=i
       );
Logger.log(response.getContentText());`

This is the reasons:

<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidHttpRequest</Code><Message>The HTTP request is invalid. Reason: Unable to parse request</Message></Error></Errors><RequestID>ae381c66-ecf5-434b-b777-a458c2d6cd11</RequestID></Response>

maozza avatar Feb 21 '21 20:02 maozza

I think there is an } missing... var i = { "InstanceIds": ["i-XXXXXX"] }

misteliy avatar Feb 25 '21 16:02 misteliy

no, this is just a typo, this is not the problem. any other idea?

maozza avatar Feb 28 '21 13:02 maozza