在处理ec2.json文件时出现上述错误
这是有效的JSON文件,请让我知道JSON文件的任何问题
"Resources":{
"EC2Instance":{
"Type":"AWS::EC2::Instance",
"Properties":{
"InstanceType":{
"Ref":"InstanceType"
},
"SecurityGroups":[
{
"Ref":"InstanceSecurityGroup"
}
],
"KeyName":{
"Ref":"KeyName"
},
"UserData":{
"Fn::Base64":{
"Fn::Join":[
"",
[
"#!/bin/bash \n",
"sudo apt-get update \n",
"sudo apt-get install wget python -y \n",
"echo UD_OF_EC2_1 >> /var/log/user-data.log \n",
"echo UD_OF_EC2_2 >> /var/log/user-data.log \n",
"echo UD_OF_EC2_3 >> /var/log/user-data.log \n"
]
]
}
},
我要附加的场景的最小可复制示例
请验证此模板是什么问题? 我尝试从git hub编辑示例模板,以添加面对该问题的用户数据
AwsCloudFormer.template
{
"AWSTemplateFormatVersion":"2010-09-09",
"Description":"AWS CloudFormer Beta - template creation prototype application. This tool allows you to create an AWS CloudFormation template from the AWS resources in your AWS account. **Warning** This template creates a single t1.micro instance in your account to run the application - you will be billed for the instance at normal AWS EC2 rates for the t1.micro.",
"Parameters":{
"AccessControl":{
"Description":" The IP address range that can be used to access the CloudFormer tool. NOTE: We highly recommend that you specify a customized address range to lock down the tool.",
"Type":"String",
"MinLength":"9",
"MaxLength":"18",
"Default":"0.0.0.0/0",
"AllowedPattern":"(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
"ConstraintDescription":"must be a valid IP CIDR range of the form x.x.x.x/x."
}
},
"Mappings":{
"RegionMap":{
"us-east-1":{
"AMI":"ami-21341f48"
},
"us-west-2":{
"AMI":"ami-d6096ee6"
},
"us-west-1":{
"AMI":"ami-ec7c4fa9"
},
"eu-west-1":{
"AMI":"ami-26688051"
},
"ap-southeast-1":{
"AMI":"ami-c0356292"
},
"ap-northeast-1":{
"AMI":"ami-7d1a777c"
},
"ap-southeast-2":{
"AMI":"ami-cd1b84f7"
},
"sa-east-1":{
"AMI":"ami-592d8c44"
},
"us-gov-west-1":{
"AMI":"ami-23c1a500"
}
}
},
"Resources":{
"CFNRole":{
"Type":"AWS::IAM::Role",
"Properties":{
"AssumeRolePolicyDocument":{
"Statement":[
{
"Effect":"Allow",
"Principal":{
"Service":[
"ec2.amazonaws.com"
]
},
"Action":[
"sts:AssumeRole"
]
}
]
},
"Path":"/"
}
},
"UserData":{
"Fn::Base64":{
"Fn::Join":[
",",
[
"#!/bin/bash -xe",
"/bin/touch /tmp/confirm_work.txt"
]
]
}
},
"CFNRolePolicy":{
"Type":"AWS::IAM::Policy",
"Properties":{
"PolicyName":"CloudFormerPolicy",
"PolicyDocument":{
"Statement":[
{
"Effect":"Allow",
"Action":[
"autoscaling:Describe*",
"cloudfront:List*",
"cloudwatch:Describe*",
"dynamodb:List*",
"dynamodb:Describe*",
"ec2:Describe*",
"elasticloadbalancing:Describe*",
"elasticache:Describe*",
"rds:Describe*",
"rds:List*",
"route53:List*",
"s3:List*",
"s3:Get*",
"s3:PutObject",
"sdb:Get*",
"sdb:List*",
"sns:Get*",
"sns:List*",
"sqs:Get*",
"sqs:List*"
],
"Resource":"*"
}
]
},
"Roles":[
{
"Ref":"CFNRole"
}
]
}
},
"CFNInstanceProfile":{
"Type":"AWS::IAM::InstanceProfile",
"Properties":{
"Path":"/",
"Roles":[
{
"Ref":"CFNRole"
}
]
}
},
"WebServer":{
"Type":"AWS::EC2::Instance",
"Properties":{
"InstanceType":"t1.micro",
"SecurityGroups":[
{
"Ref":"InstanceSecurityGroup"
}
],
"ImageId":{
"Fn::FindInMap":[
"RegionMap",
{
"Ref":"AWS::Region"
},
"AMI"
]
},
"IamInstanceProfile":{
"Ref":"CFNInstanceProfile"
}
}
},
"InstanceSecurityGroup":{
"Type":"AWS::EC2::SecurityGroup",
"Properties":{
"GroupDescription":"Enable Access via port 80",
"SecurityGroupIngress":[
{
"IpProtocol":"tcp",
"FromPort":"80",
"ToPort":"80",
"CidrIp":{
"Ref":"AccessControl"
}
}
]
}
}
},
"Outputs":{
"URL":{
"Description":"AWS CloudFormer Prototype URL. Use this endpoint to create templates from your account.",
"Value":{
"Fn::Join":[
"",
[
"http://",
{
"Fn::GetAtt":[
"WebServer",
"PublicDnsName"
]
}
]
]
}
}
}
}