如何在 AWS Cloudformation 模板中将 AWS ELB 设置为内部?

How do you make your AWS ELB internal in a AWS Cloudformation template?

我正在为 EB 应用程序和多个环境制作模板。我想确保 ELB 设置为内部,但无法在 Cloudformation 文档中找到参考。

是"Scheme"参数:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-scheme

接受 'internal' 或 'internet-facing' 作为字符串。

您可以通过在 EB 的 aws:ec2:vpc namespace:

中设置 ELBScheme 属性 在 Elastic Beanstalk 应用程序中配置内部弹性负载均衡器

Specify internal if you want to create an internal load balancer in your VPC so that your Elastic Beanstalk application cannot be accessed from outside your VPC.

要在 CloudFormation 模板中进行配置,请将选项添加到 OptionSettings property of your AWS::ElasticBeanstalk::Environment 资源:

Type: AWS::ElasticBeanstalk::Environment
Properties: 
  ApplicationName: !Ref AppName
  SolutionStackName: !Ref SolutionStackName
  OptionSettings: 
    - 
      Namespace: "aws:ec2:vpc"
      OptionName: ELBScheme
      Value: internal