Attach the label latest
when AWS SSM Parameter is created or updated. Especially useful for applications which load AWS SSM Parameters on startup.
IMPORTANT ssm-label
works per region, so deploy it in each reason that you need to use it
More regions
To deploy in other regions, replace AWS_REGION with the region's code
https://AWS_REGION.console.aws.amazon.com/cloudformation/home?region=AWS_REGION#/stacks/quickcreate?templateURL=https://
ssm-label.s3-eu-west-1.amazonaws.com/cfn-template-ssm-label.yml
On startup, use AWS SDK and fetch all parameters, filter by label latest
, save the results to a global variable (or a Singleton) and use it across your application.
Need to rollback to a previous Parameter version?
- Go to your AWS Console
- Systems Manager > Parameter Store > Click on relevant Parameter
- History tab > Click on relevant version > Click Attach labels button
- Add another label > Type latest > A good warning - Moving from version # > Confirm
-
Requires
ssm-label
to be deployed in your AWS account -
Assuming that
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
environment variables are set, or that you're using some other credentials provider, for example,aws configure
-
Both examples rely on the following environment variables
VARNAME=DEFAULT_VALUE PARAMETERS_PATH=(Required) PARAMETERS_NON_RECURSIVE='' PARAMETERS_NO_DECRYPTION='' PARAMETERS_MAX_RESULTS=10 # used in pagination, keep it as 10
- Requires Python 3.6+ and boto3
pip install boto3
- Execute
$ bash examples/python_example.sh
- Requires NodeJS 12.x, yarn and aws-sdk
- Execute
$ bash examples/node_example.sh
- It takes up to 30 seconds for the label
latest
to be attached - the Lambda Function which attaches the label runs for about ~1sec, but it takes time for it to be triggered by the CloudWatch Event - There's a limit of 100 versions per parameter - AWS hard limit, see Upcoming Features below
ssm-cleanup
- Lambda Function,
ssm-cleanup
runs once a day to clean up all parameters which have more than 30 versions, cleans up the first 20 versions, and ignores versions with labels - Lambda Function,
ssm-slack
sends a message to a Slack channel with the information about the change - actor, parameter name and version
Report issues/questions/feature requests on the Issues section.
Pull requests are welcome! Ideally, create a feature branch and issue for every single change you make. These are the steps:
- Fork this repo
- Create your feature branch from master (
git checkout -b my-new-feature
) - Add the code of your new feature
- Commit your remarkable changes (
git commit -am 'Added new feature'
) - Push to the branch (
git push --set-up-stream origin my-new-feature
) - Create a new Pull Request and tell us about your changes
Created and maintained by Meir Gabay
This project is licensed under the MIT License - see the LICENSE file for details