在第431行第15行解析块映射时没有找到预期的键

时间:2017-07-31 21:46:26

标签: amazon-web-services amazon-cloudformation

enter image description here

我试图在YAML格式的云形成模板中为elb创建proxy_protocol策略。我收到一个错误“在第431行第15行解析块映射时未找到预期的键”。我在创建CFN模板并传递所需参数时尝试运行AWS cli命令。如何通过CFN模板解决问题并运行AWS cli命令?

Proxy_policy:
          commands:
            01_Enable_proxy:
              command: "$(aws --region", !Ref "AWS::Region", " elb create-load-balancer-policy ",
                                "         --load-balancer-name ", !Ref "AppELB",
                                "         --policy-name ", !Join [ "", [!FindInMap [EnvironmentToPrettyEnvironmentMap, !Ref "Environment", label], ProxyProtocol]] ,
                                "         --policy-type-name ProxyProtocolPolicyType",
                                "         --policy-attributes AttributeName=ProxyProtocol,AttributeValue=True)"                
        set_listener:
          commands:
            01_set_listener:
              command: "$(aws --region", !Ref "AWS::Region", "elb set-load-balancer-policies-for-backend-server",
                                "   --load-balancer-name ",!Ref "AppELB", 
                                "   --policy-names ",!Join [ "", [!FindInMap [EnvironmentToPrettyEnvironmentMap, !Ref "Environment", label], ProxyProtocol]],
                                "   --instance-port 80")

1 个答案:

答案 0 :(得分:0)

Proxy_policy:
          commands:
            01_Proxy_policy:
              command: !Join ["", [ 
                               "  $(aws --region ", !Ref "AWS::Region" , " elb create-load-balancer-policy ",
                               "              --load-balancer-name ", !Ref "AppELB", 
                               "              --policy-name ", !Join [ "", [!FindInMap [EnvironmentToPrettyEnvironmentMap, !Ref "Environment", label], ProxyProtocol]] ,
                               "              --policy-type-name ProxyProtocolPolicyType ",
                               "              --policy-attributes AttributeName=ProxyProtocol,AttributeValue=True); " ]]                  
        set_listener:
          commands:
            01_set_listener:
              command: !Join ["", [
                               "  $(aws --region ", !Ref "AWS::Region", " elb set-load-balancer-policies-for-backend-server ",
                               "              --load-balancer-name ", !Ref "AppELB", 
                               "              --policy-names ", !Join [ "", [!FindInMap [EnvironmentToPrettyEnvironmentMap, !Ref "Environment", label], ProxyProtocol]] ,
                               "              --instance-port 80); " ]][enter image description here][1]