简体   繁体   English

如何在 cloudformation 映射中创建和使用安全组

[英]How to create and use security groups in cloudformation mappings

I have created a cloudformation template with a security group mappings but I am getting an error Value of property SecurityGroupIds must be of type List of String我已经创建了一个带有安全组映射的 cloudformation 模板,但我收到一个错误Value of property SecurityGroupIds must be of type List of String

Below is the template下面是模板

Mappings:
  --- Other maps --- 
  EC2SecurityGroupMap:
    dev:
      defaultsg: "sg-00582b317ae244d8d"
    prd:
      defaultsg: "sg-04666940afe8d91ff"
Resources:
  CreateEC2Instance:  
    Type: "AWS::EC2::Instance"
    Properties:
      ImageId: !FindInMap
        - ImageIdMap
        - !Ref EnvironmentName
        - defaultAMI
      InstanceType: !FindInMap
        - InstanceTypeMap
        - !Ref EnvironmentName
        - defaultInstanceType
      KeyName: !Ref EC2KeyName
      SubnetId: !Ref EC2Subnet
      SecurityGroupIds: !FindInMap [ EC2SecurityGroupMap,!Ref EnvironmentName, defaultsg ]

SecurityGroupIds must be list : SecurityGroupIds必须是列表

SecurityGroupIds: 
  - !FindInMap [ EC2SecurityGroupMap,!Ref EnvironmentName, defaultsg ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM