3

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?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Technoshaft
  • 679
  • 6
  • 18
  • Can't you just put a loop in your Bash script so that it retries if it gets this error? – John Rotenstein Nov 27 '19 at 01:01
  • @JohnRotenstein I could, I just don't know if I will get this error as there is no documentation around this error whether its a rate limiting error or whether this is a concurrent updates error. – Technoshaft Nov 27 '19 at 09:36
  • I experienced this error recently using Terraform (v1.0.11) when I had a typo in a set of parameters being deployed which lead to my script trying to update the same parameter twice within quick succession. – Jeremy Sep 23 '22 at 15:42

1 Answers1

3

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/

Devesh mehta
  • 1,505
  • 8
  • 22