类似于这个问题: How do I add a cloudformation security group ingress rule that refers to another security group?
是否可以引用位于另一个 AWS 账户内的安全组?
理想情况下,我想采用如下字符串输入参数: {帐户 ID}/{安全组 ID}
这不起作用,但不知道为什么不起作用..
"SecurityGroupEgress": [
{
"Description": "test referencing cross account sg",
"DestinationSecurityGroupId": "1234455677/sg-124455",
"IpProtocol": "icmp",
"FromPort": "-1",
"ToPort": "-1"
}
],
然后在模板入口/导出规则中引用该规则。
最佳答案
您可以使用此语法 (yaml) 来引用另一个 AWS 账户的安全组:
LoadBalancerSecurityGroup
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: 'Load Balancer SG'
VpcId: !Ref VpcId
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 443
ToPort: 443
SourceSecurityGroupOwnerId: '01234567890'
SourceSecurityGroupId: 'sg-0123456789exampleid'
这是一个入口示例,对于导出,您通常会反其道而行之,允许在另一个 sg 上访问(修改其入口)。
关于amazon-web-services - Cloudformation 中的跨账户安全组引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60179762/