我在 ubuntu 上使用 aws eb deploy 命令来部署如下所示的cloudformation脚本。我收到如下错误。
注意:我的其他cloudformation脚本没有任何问题。
错误无效的Yaml :“”中不允许使用映射值 CacheSecurityGroupName:Ref:“CacheSecurityGroup” ^,JSON异常:无效的JSON:位置0处的意外字符(R)。更新配置文件。 错误:无法部署应用程序。
Resources:
CacheSecurityGroupIngress:
Type: "AWS::ElastiCache::SecurityGroupIngress"
Properties:
CacheSecurityGroupName: Ref: "CacheSecurityGroup"
EC2SecurityGroupName: Ref: "AWSEBSecurityGroup"
寻找解决问题的指示
答案 0 :(得分:3)
您应该在新行中使用完整的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"