Created
January 7, 2016 05:30
-
-
Save eccyan/0216d44cab132b575003 to your computer and use it in GitHub Desktop.
Rotate application versions in Elastic Beanstalk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
APPNAME= | |
ROTATE_COUNT=200 | |
application_versions() { | |
aws elasticbeanstalk describe-application-versions --application-name $APPNAME | \ | |
jq -r '.ApplicationVersions | .[] | .VersionLabel' ; | |
} | |
delete_application_versions() { | |
for label in $1 ; do | |
echo Delete application version: $label ; | |
aws elasticbeanstalk delete-application-version --application-name $APPNAME --version-label $label ; | |
done | |
} | |
delete_application_versions "$(application_versions | tail -n +$(expr $ROTATE_COUNT + 1))" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment