AWS Cloud格式:使用ApplicationVersionLifecycleConfig配置Elastic Beanstalk

时间:2018-02-22 18:04:49

标签: amazon-web-services elastic-beanstalk

我是EB:我使用aws cli将应用程序部署到我的EB。 首先我上传到S3 然后我创建一个新版本(或更新现有版本) 我更新了环境。

这很有效,但现在我已经有很多版本了。由于我的环境是用云形式创建的,我想调整它。

我读到了Elastic beanstalk here的以下设置。

DeleteSourceFromS3: Boolean
Enabled: Boolean
MaxCount: Integer

这是我可以使用的东西。在MaxCount版本之后,EB将丢弃旧版本(如果我也想要也从s3开始)。

有没有办法用AWS CLI命令或参数重新创建它?

如果没有,我需要将它集成到我的cloudformation中。 (AWS CLI可以处理脚本,但不允许在我的控制台中进行设置。)

问题在于我的cloudformation中的集成。 我怎样才能将它添加到我的EB中,它现在看起来像这样:

Type: "AWS::ElasticBeanstalk::Application"
Properties:
  ApplicationName: xxx
  Description: xxx

1 个答案:

答案 0 :(得分:1)

具有资源生命周期设置的EB的Cloudformation片段:

Type: "AWS::ElasticBeanstalk::Application"
Properties:
  ApplicationName: String
  Description: String
  ResourceLifecycleConfig:
    ServiceRole: string
    VersionLifecycleConfig:
      MaxCountRule:
        Enabled: true
        MaxCount: 5
        DeleteSourceFromS3: true
      MaxAgeRule:
        Enabled: true
        MaxAgeInDays: 10
        DeleteSourceFromS3: true
相关问题