0

我正在使用aws eb deploy命令ubuntu部署下面顯示的雲形態腳本。我收到如下所示的錯誤。AWS Cloudformation + Beanstalk錯誤無效的YAML模板

注意:我的其他cloudformation腳本沒有任何問題。

Error Invalid Yaml: mapping values are not allowed here in "" CacheSecurityGroupName: Ref: "CacheSecurityGroup" ^, JSON exception: Invalid JSON: Unexpected character (R) at position 0.. Update the configuration file. ERROR: Failed to deploy application.

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

尋找指針來解決這個問題

回答

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" 
相關問題