gpt4 book ai didi

amazon-web-services - 向 AWS Cloudformation 中的安全组 Ingress 数组元素添加描述

转载 作者:行者123 更新时间:2023-12-03 07:44:30 27 4
gpt4 key购买 nike

在Cloudformation中,是否可以添加安全组描述,如下例所示?

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

"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'

最佳答案

"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"
}
],

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

关于amazon-web-services - 向 AWS Cloudformation 中的安全组 Ingress 数组元素添加描述,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54107582/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com