23
Automate Start/Stop/Delete/Create AWS synthetic canaries
This is the second post in the series. This guide will walk you through starting, stopping, deleting, and creating a synthetic canary. Useful if you want to automate the process of producing canaries as part of your devops pipeline or if you don't want to log into the AWS console every time you want to create, start, stop or delete a canary.
All of this can be achieved with the Python script I developed using AWS Python SDK and shared on github. The script's current version allows you to do the following:
- Start & Stop All Canaries
- Start & Stop a Canary
- Delete a Canary
- Script Runtime Versions
- Create a Canary
To Start & Stop all canaries, run the script with the following command.
./synthetic_canary.py stop
./synthetic_canary.py start
To Start & Stop a canary, run the script with the following command.
./synthetic_canary.py stop/start {canary name}
Example
./synthetic_canary.py stop workload
./synthetic_canary.py start workload
To delete a canary, run the script with the following command.
./synthetic_canary.py delete {canary name}
Example
./synthetic_canary.py delete workload
Returns a list of Synthetics canary runtime versions and their dependencies. When creating a canary, you must pass in the script runtime version. Make this call first, then extract the appropriate version to use for the create canary script.
./synthetic_canary.py runtime
To create a canary, run the script with the following command.
./synthetic_canary.py create {canary name}
Example
./synthetic_canary.py create workload
A sample python GET api canary blueprint script is also included in the github repo to assist you to get started with developing an api synthetic canary. For it to work in your environment, you must change the script with the correct api end point and headers. Make sure you follow the correct folder structure when uploading the zip nodejs or python canary script to S3.
Hopefully, this script will come in handy to you in the aforementioned case. Keep an eye out for the script updates as I add new features. Contact me if you would like to contribute to the code. Also, leave a comment or a star on the git repo if you find the script useful.
Note: Before using the script in production, try it in your development/test environment first.
Thanks for reading!
If you enjoyed this article feel free to share it on social media đ
Github: hseera
23