Json 在cloudformation中创建ELB时出错

Json 在cloudformation中创建ELB时出错,json,amazon-web-services,yaml,amazon-cloudformation,devops,Json,Amazon Web Services,Yaml,Amazon Cloudformation,Devops,获取错误模板无效:模板格式错误:模板的资源块中未解析的资源依赖项[子网-,sg-,子网-,vpc-*] 请帮助我添加如果专有网络-*********,子网-*********,sg-************是您现有专有网络、子网和安全组的实际ID,那么您不需要!请参阅,以引用它们 只需提供它们,而无需!参考,例如 AWSTemplateFormatVersion: 2010-09-09 Resources: MyLoadBalancer: Type: 'AWS::ElasticLoa

获取错误模板无效:模板格式错误:模板的资源块中未解析的资源依赖项[子网-,sg-,子网-,vpc-*]


请帮助我添加如果
专有网络-*********
子网-*********
sg-************
是您现有专有网络、子网和安全组的实际ID,那么您不需要
!请参阅
,以引用它们

只需提供它们,而无需
!参考
,例如

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-******
新模板版本:

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

VpcId: vpc-******

添加了
MyTargetGroup
,删除了
AvailabilityZones
Metadata

谢谢@Marcin现在我在创建此组时遇到两个错误,遇到了不支持的属性AvailabilityZones以下资源未能创建:[MyLoadBalancer]。请求的回滚user@shubhamkamboj该模板还有许多其他问题。很难同时解决所有这些问题。也许可以检查模板的来源。它可能被错误地copp或修改。我会给出一个答案。它显示了一个模板错误。实际上,我的目标是使用ELB创建自动缩放。因此,如果您有任何用于创建自动缩放的模板。你能把这个寄给我吗。“我是云计算方面的新手。@shubhamkamboj遗憾的是,您的请求是特定于应用程序和用例的,我没有一个通用的模板。我的建议是查看ASG示例以及aws提供的示例模板。它们是创建自己模板的良好开端。另外,如果我的回答有帮助,我们将不胜感激。@shubhamkamboj没问题。希望能成功。如果您将来有问题,请随时提出新问题。
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-******