2014-09-05 57 views
0

我在通过Java Eclipse创建亚马逊堆栈。JSON格式错误-Anzon EC2实例创建

那朵下面的代码线被投掷

csr.setTemplateURL("https://s3.amazonaws.com/cloudformation-templates-us-east- 1/AutoScalingMultiAZSample.template"); 

我正在错误作为错误:

陷入异常:参数:[KEYNAME]必须具有值(服务:AmazonCloudFormation;状态代码: 400;错误代码:ValidationError;请求ID:9363d711-3535-11e4-8cf2-913ef42879cb) 效应初探状态代码:400

的json模板的网址是 https://s3.amazonaws.com/cloudformation-templates-us-east-1/AutoScalingMultiAZSample.template

请帮助检测错误的确切来源。

+0

为什么会出现嵌入在URL空格的字符串?这是一个错字还是它在源代码中的URL? – 2014-09-05 20:02:47

回答

1

好吧,我试图验证你的JSON模式使用在线验证。

http://jsonlint.com/

我只是复制您的JSON模式,并粘贴在那里。它表示无效架构期待{在第1行。好吧,当然,我必须把开放和结束括号,并在您的架构之间。但它又给了错误。额外括号}在最后一行。所以我不得不删除它。然后json模式被验证。这意味着你的模式中的某个地方正在增加一个右括号}。

我想你在哪里犯错误的地方:

"InstanceSecurityGroup" : { 
     "Type" : "AWS::EC2::SecurityGroup", 
     "Properties" : { 
     "GroupDescription" : "Enable SSH access and HTTP from the load balancer only", 
     "SecurityGroupIngress" : [ { 
      "IpProtocol" : "tcp", 
      "FromPort" : "22", 
      "ToPort" : "22", 
      "CidrIp" : { "Ref" : "SSHLocation"} 
     }, 
     { 
      "IpProtocol" : "tcp", 
      "FromPort" : { "Ref" : "WebServerPort" }, 
      "ToPort" : { "Ref" : "WebServerPort" }, 
      "SourceSecurityGroupOwnerId" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "SourceSecurityGroup.OwnerAlias"]}, 
      "SourceSecurityGroupName" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "SourceSecurityGroup.GroupName"]} 
     } ] 
     } 
    }//Extra Bracket i think so 
    }, 

    "Outputs" : { 
    "URL" : { 
     "Description" : "The URL of the website", 
     "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]} 
    } 
    } 
} 
+0

即使删除括号后,我得到了同样的错误在eclipse.i验证架构在http://jsonlint.com/,它有showin有效,没有删除括号。但如果删除括号,然后它是showin作为解析错误。请帮忙。 – user3407271 2014-09-07 03:59:34