【问题标题】:Add description to security group Ingress array elements in AWS Cloudformation向 AWS Cloudformation 中的安全组 Ingress 数组元素添加描述
【发布时间】:2019-06-04 01:51:16
【问题描述】:

在 Cloudformation 中,是否可以像下面的示例一样添加安全组描述?

我在文档 (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html) 中看到过,但我从未见过 1 个带有 IP 规则描述的官方示例,仅适用于 GroupDescription。我发现这很有帮助,因为它有助于识别 IP 所指的内容。 那么,例如,这些示例 sn-ps 是否有效?

"InstanceSecurityGroup" : {
   "Type" : "AWS::EC2::SecurityGroup",
   "Properties" : {
      "GroupDescription" : "Enable SSH access via port 22",
      "SecurityGroupIngress" : [ {
         "IpProtocol" : "tcp",
         "FromPort" : 22,
         "ToPort" : 22,
         "CidrIp" : "0.0.0.0/0",
         "Description" : "some description" <<<<<<<<<here
      } ]
   }
}

其他例子

 LoadBalancerSG:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupName: !Join ['-', [!Ref 'StackName', 'LoadBalancerSG']]
      GroupDescription: Access to the load balancer
      VpcId:
        Fn::ImportValue: 'VpcID'
      SecurityGroupIngress:
      - IpProtocol: tcp
        Description: 'this IP is ...' <<<<< here
        CidrIp: 10.5.0.0/14
        FromPort: '80'
        ToPort: '80'
      - IpProtocol: tcp
        Description: 'this other IP is ...' <<<<<< here
        CidrIp: 10.5.0.0/14
        FromPort: '8080'
        ToPort: '8080'

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation


    【解决方案1】:
    "SecurityGroupIngress": [{
            "IpProtocol": "tcp",
            "CidrIp": "aa.xx.yy.zz/32",
            "FromPort": "0000",
            "ToPort": "0000"
        }, {
            "IpProtocol": "tcp",
            "CidrIp": "bb.xx.yy.zz/32",
            "FromPort": "0000",
            "ToPort": "0000"
        }, {
            "IpProtocol": "tcp",
            "Description": "ELB-EC2",
            "SourceSecurityGroupId": "sg-nnnnnnnnnnnnn",
            "FromPort": "000",
            "ToPort": "000"
        }
    ],
    

    出于安全目的,实际值已更改,但除此之外,这是一个工作模板

    【讨论】:

      猜你喜欢
      • 2019-07-09
      • 2016-12-15
      • 1970-01-01
      • 1970-01-01
      • 2022-08-09
      • 2020-02-06
      • 2020-12-20
      • 2015-08-01
      • 1970-01-01
      相关资源
      最近更新 更多