模板格式错误:未解决的资源依赖关系[SUBNET-057BA3DF40F87DA4E]在模板的资源块中 我正在尝试使用CloudFormation在VPC中创建EC2实例,当我运行以下内容时: AWS CloudFormation create-create-stack - stack-name stack -region us-east-1-template-body file://file.yml ...

问题描述 投票:0回答:1

An error occurred (ValidationError) when calling the CreateStack operation: Template format error: Unresolved resource dependencies [subnet-057ba3df40f87da4e] in the Resources block of the template

知道这是我用来创建此堆栈的文件:

Resources: accessSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: "new EC2 security group for HTTP and SHH ports" SecurityGroupIngress: - IpProtocol: tcp FromPort: 80 ToPort: 80 CidrIp: 0.0.0.0/0 SecurityGroupEgress: - IpProtocol: -1 FromPort: -1 ToPort: -1 CidrIp: 0.0.0.0/0 VpcId: "vpc-09495a820716bff3b" EC2Instance: Type: AWS::EC2::Instance Properties: ImageId: "ami-0022f774911c1d690" InstanceType: t3.micro NetworkInterfaces: - AssociatePublicIpAddress: "true" DeviceIndex: "0" GroupSet: - Ref: "accessSecurityGroup" SubnetId: Ref: "subnet-057ba3df40f87da4e" UserData: Fn::Base64: !Sub | #!/bin/bash sudo yum update -y sudo yum install -y httpd sudo systemctl start httpd sudo systemctl enable httpd SecurityGroupIds: - !Ref accessSecurityGroup

我对上述
VpcId
存在,我不确定问题是什么。

SubnetId
ref

The intrinsic function

 returns the value of the specified parameter or resource.
由于它不是指参数或资源,并且该值是硬编码

amazon-web-services amazon-ec2 aws-cloudformation subnet
1个回答
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.