OptionSettings 的多个值
Multiple values for OptionSettings
我需要将多个安全组添加到我的 EB 环境中。这是我的 EB 环境模板的一部分:
Type: 'AWS::ElasticBeanstalk::Environment'
Properties:
...
OptionSettings:
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value: ...
我试过:
使用安全组 2x
但后者覆盖了前面的值
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value:
- !Sub ${EnvironmentPrefix}-ssh
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value:
- launch-wizard-1
使用数组
但最终出现错误:
Value of property Value must be of type String
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value:
- !Sub ${EnvironmentPrefix}-ssh
- launch-wizard-1
如何为'AWS::ElasticBeanstalk::Environment'设置多个安全组?
根据 documentation,您可以传递逗号分隔的安全组列表作为值。
You can provide a single string of comma-separated values that contain
the name of existing Amazon EC2 security groups or references to
AWS::EC2::SecurityGroup resources created in the template. If you use
Amazon VPC with Elastic Beanstalk so that your instances are launched
within a virtual private cloud (VPC), specify security group IDs
instead of a security group name.
所以:
Type: 'AWS::ElasticBeanstalk::Environment'
Properties:
...
OptionSettings:
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value: sg-1,sg-2,sg-3
我需要将多个安全组添加到我的 EB 环境中。这是我的 EB 环境模板的一部分:
Type: 'AWS::ElasticBeanstalk::Environment'
Properties:
...
OptionSettings:
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value: ...
我试过:
使用安全组 2x
但后者覆盖了前面的值
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value:
- !Sub ${EnvironmentPrefix}-ssh
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value:
- launch-wizard-1
使用数组
但最终出现错误:
Value of property Value must be of type String
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value:
- !Sub ${EnvironmentPrefix}-ssh
- launch-wizard-1
如何为'AWS::ElasticBeanstalk::Environment'设置多个安全组?
根据 documentation,您可以传递逗号分隔的安全组列表作为值。
You can provide a single string of comma-separated values that contain the name of existing Amazon EC2 security groups or references to AWS::EC2::SecurityGroup resources created in the template. If you use Amazon VPC with Elastic Beanstalk so that your instances are launched within a virtual private cloud (VPC), specify security group IDs instead of a security group name.
所以:
Type: 'AWS::ElasticBeanstalk::Environment'
Properties:
...
OptionSettings:
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: SecurityGroups
Value: sg-1,sg-2,sg-3