【问题标题】:AWS Cloudformation+Beanstalk error Invalid YAML templateAWS Cloudformation+Beanstalk 错误 YAML 模板无效
【发布时间】:2017-04-05 04:53:02
【问题描述】:

我在 ubuntu 上使用 aws eb deploy 命令来部署如下所示的 cloudformation 脚本。我收到如下所示的错误。

注意:我的其他 cloudformation 脚本可以正常工作。

错误无效 Yaml:“”中不允许映射值 CacheSecurityGroupName:参考:“CacheSecurityGroup” ^,JSON 异常:无效的 JSON:位置 0 的意外字符 (R).. 更新配置文件。 错误:无法部署应用程序。

Resources:
  CacheSecurityGroupIngress:
    Type: "AWS::ElastiCache::SecurityGroupIngress"
    Properties:
      CacheSecurityGroupName: Ref: "CacheSecurityGroup"
      EC2SecurityGroupName: Ref: "AWSEBSecurityGroup"

寻找解决问题的指针

【问题讨论】:

    标签: amazon-web-services amazon-ec2 amazon-elastic-beanstalk amazon-cloudformation boto3


    【解决方案1】:

    您应该在新行中使用完整的 Ref 函数形式,如下所示:

    Resources:
      CacheSecurityGroupIngress:
        Type: "AWS::ElastiCache::SecurityGroupIngress"
        Properties:
          CacheSecurityGroupName:
            Ref: "CacheSecurityGroup"
          EC2SecurityGroupName:
            Ref: "AWSEBSecurityGroup"
    

    ...或缩写形式,如下所示:

    Resources:
      CacheSecurityGroupIngress:
        Type: "AWS::ElastiCache::SecurityGroupIngress"
        Properties:
          CacheSecurityGroupName: !Ref "CacheSecurityGroup"
          EC2SecurityGroupName: !Ref "AWSEBSecurityGroup"
    

    【讨论】:

      猜你喜欢
      • 2021-11-26
      • 2017-10-30
      • 2020-04-24
      • 2018-08-24
      • 1970-01-01
      • 1970-01-01
      • 2021-05-24
      • 1970-01-01
      • 2016-03-19
      相关资源
      最近更新 更多