sh 删除旧的ElasticBeanstalk应用程序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 删除旧的ElasticBeanstalk应用程序相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env ruby

require 'time'
require 'json'

ALLOWED_NAMES = [ENV['APP']]

t = DateTime.now - 14

json = ARGF.read
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"]}"
    end
  end
end
aws elasticbeanstalk describe-application-versions --profile $PROFILE
./list-versions.sh | ./parse_versions.rb | ./delete-versions.sh
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!"
done

以上是关于sh 删除旧的ElasticBeanstalk应用程序的主要内容,如果未能解决你的问题,请参考以下文章