Siam Habib
Siam Habib

Reputation: 35

Does `amz-sdk-invocation-id` header provide idempotency for aws api calls?

So, I was looking at the source code for botocore and it seems that botocore adds a request header called amz-sdk-invocation-id in the headers in a function called add_retry_headers.

Does this mean that every request generated by boto3 is idempotent? What about requests that take a client-token parameter like EC2. client-token is supposed to provide idempotency for creating ec2 instances. How would that work? I mean what would happen if client-token are different but amz-sdk-invocation-id are same or if amz-sdk-invocation-id are different but client-token are the same?

Upvotes: 0

Views: 309

Answers (1)

Bert Blommers
Bert Blommers

Reputation: 2093

The Kotlin SDK defines this property as:

The unique request ID generated for tracking the request in-flight client side.

This already hints to the fact that the property is only used client side, not on the server (AWS) side.

Moreover: it is possible to manually craft a HTTP request to create EC2 instances, and it is not necessary to add this header. (Page with information on what is necessary for a raw HTTP request, and the list of required headers - which does not even mention the aws-sdk-invocation-id)

So in conclusion: Treat it as a implementation detail for botocore only, and only rely on client-token, because that is the only parameter that is explicitly documented for providing idempotency.

Upvotes: 1

Related Questions