-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected breaking change in RunInstances (not idempotent anymore. Even with client token) #4406
Comments
Our integration test suite heavily relies on the idempotency guarantees The behaviour I'm relying on has been documented here: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html
The returned error also isn't documented in It will require significant refactoring of our code to adopt for this non-idempotent behaviour. For one we rely on retrieving the instance id of the terminated instance through RunInstances idempotency. Please undo whatever change was made on the server or update the docs that RunInstances is not idempotent anymore. But I expect a lot of downstream fallout. A lot of tooling relies on the idempotency of the RunInstances API |
Update: seems the error code is documented here now: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html |
Hi @arianvp, Thank you for reporting the issue. At first glance, there's a bit of a contradiction in the EC2 docs. As you linked above, the docs do state that subsequent requests will succeed as long as they're the same input parameters with the same client token:
Looking at the docs for the error, they imply that the above does not apply if the instance is terminated:
If I'm reading this correctly, the first docs should be updated to include this caveat. You mentioned that this has been running for years without issue- can you confirm that nothing else has changed on your side that might cause the instance to now terminate before this call? I've also reached out to the EC2 team to confirm the expected behavior - (internal ticket ID: V1656514867) |
The EC2 team confirmed that this is not a behavioral change and is working as expected. Repeated calls with the same token can result in errors if the instance is terminated, if the idempotency token expires, or if the request parameters change between the two calls. I've requested a docs update on the paragraph you quoted to clarify when idempotency does not apply. If you're looking to get rid of this error, please update the token after termination of your instance. |
Thanks for the clarification! I'll update our code to handle the exception. |
Describe the bug
Calling RunInstances on a terminated instance with the same client token as launched used to succeed and that's also the documented behaviour in the EC2 docs
The operation started failing with (IdempotentInstanceTerminated) exception which makes the idempotency token not act idempotent anymore. It is a documented feature of the EC2 API that if the request succeeds once that ant subsequent call of the API with the same idempotency token also succeeds. That promise is now broken.
This is a pretty bad breaking changes as it breaks the idempotency promise of the EC2 API. Which hasn't changed in like a decade.
It's causing our automation to fail after working for years.
https://github.com/NixOS/amis/actions/runs/12969672545/job/36174001261
Regression Issue
Expected Behavior
Don't throw (IdempotentInstanceTerminated). Instead the instance id of the terminated instance is returned and the instance state is terminated
Current Behavior
It throws
botocore.exceptions.ClientError: An error occurred (IdempotentInstanceTerminated) when calling the RunInstances operation: The client token you have provided is associated with a terminated instance. Please use a different client token.
Reproduction Steps
Call RunInstances on a terminated instance with same client token.
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.35.30
Environment details (OS name and version, etc.)
Ubuntu 24
The text was updated successfully, but these errors were encountered: