【发布时间】:2019-12-02 06:00:40
【问题描述】:
我想通过 cloudformation 部署一个带有 SecurityGroup 入口规则的 SecurityGroup。
我目前在 yaml 文件中使用这个:
Security
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Securitygroup with access to itself
SecurityIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: !Ref Security
SourceSecurityGroupId: !Ref Security
IpProtocol: tcp
FromPort: -1
这会给我一个错误,指出 SucurityGroupId 格式错误。创建 SecurityIngress 时会发生该错误。请注意,我已将堆栈名称更改为“堆栈名称”。
ID 无效:\"Stackname-Security-N12M8127812\"(应为 \"sg-\")
所以我猜 !Ref 不会返回 SecurityGroup 的 ID,而是返回名称。 有没有办法获取id?
【问题讨论】:
标签: amazon-web-services amazon-cloudformation aws-security-group