gpt4 book ai didi

json - 在cloudformation中创建ELB时出现错误

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

AWSTemplateFormatVersion: 2010-09-09
Resources:
MyLoadBalancer:
Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer'
Properties:
IpAddressType: ipv4
AvailabilityZones:
- ap-southeast-1
Name: mytestingELB
Scheme: internet-facing
Type: application
SecurityGroups:
- !Ref sg-**********
Subnets:
- !Ref subnet-******
- !Ref subnet-*******
Metadata:
'AWS::CloudFormation::Designer':
id: 3f17841f-7296-4aeb-a464-94dbbf6542fd
'AWS::ElasticLoadBalancingV2::TargetGroup':
Properties:
HealthCheckIntervalSeconds: '30'
HealthCheckPath: /
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: '5'
HealthyThresholdCount: '5'
Matcher:
HttpCode: '200'
Name: testingtargetgroup
Port: '80'
Protocol: HTTP
TargetType: instance
UnhealthyThresholdCount: '2'
VpcId: !Ref vpc-******

收到错误模板无效:模板格式错误:未解析的资源依赖项 [子网-、sg-、子网- , vpc-*] 在模板的资源 block

请帮我添加

最佳答案

如果vpc-*****subnet-******sg-********* * 是您现有 VPC、子网和安全组的实际 ID,那么您不需要 !Ref 来引用它们。

只需提供它们,无需 !Ref,例如

SecurityGroups:
- sg-**********
Subnets:
- subnet-******
- subnet-*******

VpcId: vpc-******

新模板版本:

AWSTemplateFormatVersion: 2010-09-09
Resources:
MyLoadBalancer:
Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer'
Properties:
IpAddressType: ipv4
Name: mytestingELB
Scheme: internet-facing
Type: application
SecurityGroups:
- !Ref sg-**********
Subnets:
- !Ref subnet-******
- !Ref subnet-*******

MyTargetGroup
'AWS::ElasticLoadBalancingV2::TargetGroup':
Properties:
HealthCheckIntervalSeconds: '30'
HealthCheckPath: /
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: '5'
HealthyThresholdCount: '5'
Matcher:
HttpCode: '200'
Name: testingtargetgroup
Port: '80'
Protocol: HTTP
TargetType: instance
UnhealthyThresholdCount: '2'
VpcId: !Ref vpc-******
添加了

MyTargetGroup 并删除了 AvailabilityZonesMetadata

关于json - 在cloudformation中创建ELB时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62650879/

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