aws-sdk-js icon indicating copy to clipboard operation
aws-sdk-js copied to clipboard

EC2 RunInstancesRequest potential improperly named parameter

Open mattBrzezinski opened this issue 3 years ago • 6 comments

Confirm by changing [ ] to [x] below:


I have a repository AWS.jl which implements an SDK for AWS in JuliaLang which we use the JSON definitions of this project to generate our code from. We ran into an issue with the EC2 RunInstances request, and was wondering if this is either a bug or my misunderstanding.

The RunInstancesRequest (cannot direct link since file is too large) has a parameter ClientToken defined as,

"ClientToken": {
  "shape": "String",
  "documentation": "<p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.</p> <p>For more information, see <a href=\"https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html\">Ensuring Idempotency</a>.</p> <p>Constraints: Maximum 64 ASCII characters</p>",
  "idempotencyToken": true,
  "locationName": "clientToken"
},

When we submit requests we auto-generate a UUID4 for this parameter and call it clientToken because it has a locationName in its definition.

However when we submit requests with this default parameter we get the response back,

<Response><Errors><Error><Code>UnknownParameter</Code><Message>The parameter clientToken is not recognized</Message></Error></Errors><RequestID>de17cd6b-0614-495a-a476-53c6fb9f9884</RequestID></Response>""")

When we set this value to ClientToken, with a capital C. The request is successful. My understanding so far has been, use the top-level parameter name (in this example ClientToken) as the parameter name when making requests. However if a locationName (in this example clientToken)is present in the JSON object use that instead of the top-level name.

I'm wondering if my understanding is correct here and this is just a bug, or if I'm misunderstanding and there is more to locationName values in parameters.

Thanks!

cc: https://github.com/JuliaCloud/AWS.jl/issues/444

mattBrzezinski avatar Sep 20 '21 14:09 mattBrzezinski

Hi @mattBrzezinski thanks for opening this issue, I believe your understanding is correct, as for the SDK there are no customizations around EC2 meaning all the logic is done by the EC2 team and SDK validates it against the model provided. With that being said, the clientToken is being used at several positions which makes it very unlikely to be a bug but I can stil check with the EC2 team if thats an issue.

Thanks

ajredniwja avatar Sep 21 '21 01:09 ajredniwja

Thanks for the reply! It seems that there are various other requests which run into this issue. Another example is the ModifyInstanceAttribute with the instanceId parameter.

mattBrzezinski avatar Sep 21 '21 01:09 mattBrzezinski

@mattBrzezinski Let me reach-out to the EC2 team to have more clarity, this may take a while.

ajredniwja avatar Sep 21 '21 01:09 ajredniwja

Just wanted to follow up on this issue as it's been two weeks.

mattBrzezinski avatar Oct 05 '21 17:10 mattBrzezinski

Bumping again as it's been over a month.

mattBrzezinski avatar Oct 28 '21 16:10 mattBrzezinski

botocore actually special-cases EC2 for this: https://github.com/boto/botocore/blob/c920c8f40c6fb61b9b3f3b1d76ff3c14fdad3490/botocore/serialize.py#L319

iamed2 avatar Nov 18 '21 22:11 iamed2