AWS Elastic Beanstalk .ebextensions 优先顺序

AWS Elastic Beanstalk .ebextensions order of precedence

如果我在 .ebextensions 文件夹中的两个配置文件中应用一个设置,最后一个文件会覆盖第一个文件中的设置吗?

例如,取两个定义了实例角色设置的文件:

.ebextensions/0001-base.config

option_settings:
  IamInstanceProfile: aws-ec2-role

.ebextensions/0010-app.config

option_settings:
  IamInstanceProfile: aws-app-role

Beanstalk EC2实例将被赋予什么角色? aws-ec2-角色或 aws-app-角色?

.ebextensions 按字母顺序执行,因此 aws-app-role 将是您的 IamInstanceProfile 选项设置的最终结果。

如果您尝试部署 .ebextensions,您的语法会导致编译错误,这是执行您想要的操作的正确方法。

option_settings:
      "aws:autoscaling:launchconfiguration":
          IamInstanceProfile: aws-app-role