Skip to content

Instantly share code, notes, and snippets.

Created March 16, 2016 05:33
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Delete old ElasticBeanstalk application versios
echo "Starting to delete versions of $APP"
while read ver; do
echo "Deleting version $ver"
aws elasticbeanstalk delete-application-version --version-label $ver --profile $PROFILE --application-name $APP
echo "Version $ver deleted!"
./ | ./parse_versions.rb | ./
aws elasticbeanstalk describe-application-versions --profile $PROFILE
#!/usr/bin/env ruby
require 'time'
require 'json'
t = - 14
json =
hash = JSON.parse(json)
versions = hash["ApplicationVersions"]
versions.each do |ver|
application_name = ver["ApplicationName"]
created_at = DateTime.parse(ver["DateCreated"])
if ALLOWED_NAMES.include?(application_name)
if t > created_at
puts "#{ver["VersionLabel"]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment