gpt4 book ai didi

amazon-web-services - 我在 CloudFormation 中遇到多个安全组的问题

转载 作者:行者123 更新时间:2023-12-03 07:35:38 25 4
gpt4 key购买 nike

我正在尝试选择两个安全组,一个是来自参数的安全组,另一个是新的安全组。

但出现以下错误。我该如何解决这个问题?

AWSTemplateFormatVersion : 2010-09-09
Description: "simple web layer"
Parameters:
ImageId:
Description: 'web Layer'
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
AllowedPattern: "^[a-zA-Z][-a-zA-Z0-9]*$"
Default: ami-244333
Vpc:
Description: enter vpc
Type: List<AWS::EC2::VPC::Id>
Securitycab:
Type: String
Default: 0.0.0.0/0
Description: enter vpc ip range
Subnets:
Description: enter subnet
Type: List<AWS::EC2::Subnet::Id>
Default: subnet-384736383838
Securitygroup:
Description: enter sc
Type: List<AWS::EC2::SecurityGroup::Id>
Default: sg-237377383773873
Resources:
Lpsecurity:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: vpc-1a2b3c4d
GroupDescription: Sample target security group
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: !Ref Securitycab
MyEC2Instance1:
Type: 'AWS::EC2::Instance'
Properties:
ImageId: !Ref ImageId
InstanceType: t2.large
VpcId: !Ref Vpc
SubnetId: !Select [ 0, !Ref Subnets ]
SecurityGroupIds:
- !Ref Securitygroup
!Ref Lpsecurity

Error : Unsolved Resource dependence [Securitygroup !Ref Lpsecurity] in the resource block of the template.

最佳答案

列表中的每个元素之前应有破折号

这是来自您的其他 I have a problem in cloud formation. Error when using Fn::Join with a parameter 的建议代码问题:

      SecurityGroupIds:
- !GetAtt Securitygroup.GroupId
- !GetAtt Lpsecurity.GroupId

或者,您可以使用:

      SecurityGroupIds:
- !Ref Securitygroup
- !Ref Lpsecurity

关于amazon-web-services - 我在 CloudFormation 中遇到多个安全组的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60126235/

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