I have a bash script that uses AWS CLI to put value to a parameter in AWS Systems Manager Parameter Store.
The bash script is run on an EC2 instance and there are several instances deployed. So I have no control over the concurrency of the bash scripts. I need the script to retry if there were concurrent updates and the update from the script was rejected.
I have checked the AWS documentation and searched other questions and forums for a documentation on this topic.
All I can refer to is a "TooManyUpdates" 400 error documented here.
What is the behaviour of AWS Systems Manager Parameter Store on concurrent updates?
I would recommend using DynamoDB Lock Client to maintain the read-write lock on the SSM parameter.
The Amazon DynamoDB Lock Client is a general purpose distributed locking library built for DynamoDB. The DynamoDB Lock Client supports both fine-grained and coarse-grained locking as the lock keys can be any arbitrary string, up to a certain length. DynamoDB Lock Client is an open-source project that will be supported by the community. Please create issues in the GitHub repository with questions.
Reference: https://aws.amazon.com/blogs/database/building-distributed-locks-with-the-dynamodb-lock-client/