2015-03-06 2 views
0

Я пытаюсь использовать формирование облаков для создания стека, но он возвращает ошибку, которую я не могу решить.Проблема с облачной областью Amazon с созданием экземпляра

Также я не совсем уверен, что правильно выполняю роль IAM для S3.

Любая помощь будет оценена по достоинству.

14:06:25 UTC-0700 ROLLBACK_IN_PROGRESS AWS::CloudFormation::Stack anothertest The following resource(s) failed to create: [ElasticSearchNodeDev1, ElasticSearchMasterDev1]. . Rollback requested by user. 
14:06:23 UTC-0700 CREATE_FAILED AWS::EC2::Instance ElasticSearchMasterDev1 Value of property IamInstanceProfile must be of type String 
14:06:23 UTC-0700 CREATE_FAILED AWS::EC2::Instance ElasticSearchNodeDev1 Value of property IamInstanceProfile must be of type String 

Код

{ 
    "AWSTemplateFormatVersion" : "2010-09-09", 

    "Parameters" : { 
    "KeyName": { 
     "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", 
     "Type": "AWS::EC2::KeyPair::KeyName", 
     "ConstraintDescription" : "must be the name of an existing EC2 KeyPair." 
    }, 

    "InstanceType" : { 
     "Description" : "WebServer EC2 instance type", 
     "Type" : "String", 
     "Default" : "m1.small", 
     "AllowedValues" : [ "t1.micro", "t2.micro", "t2.small", "t2.medium", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge", "g2.2xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "hi1.4xlarge", "hs1.8xlarge", "cr1.8xlarge", "cc2.8xlarge", "cg1.4xlarge"] 
, 
     "ConstraintDescription" : "must be a valid EC2 instance type." 
    }, 

    "SSHLocation" : { 
     "Description" : "The IP address range that can be used to SSH to the EC2 instances", 
     "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" : { 
    "AWSInstanceType2Arch" : { 
     "t1.micro" : { "Arch" : "PV64" }, 
     "t2.micro" : { "Arch" : "HVM64" }, 
     "t2.small" : { "Arch" : "HVM64" }, 
     "t2.medium" : { "Arch" : "HVM64" }, 
     "m1.small" : { "Arch" : "PV64" }, 
     "m1.medium" : { "Arch" : "PV64" }, 
     "m1.large" : { "Arch" : "PV64" }, 
     "m1.xlarge" : { "Arch" : "PV64" }, 
     "m2.xlarge" : { "Arch" : "PV64" }, 
     "m2.2xlarge" : { "Arch" : "PV64" }, 
     "m2.4xlarge" : { "Arch" : "PV64" }, 
     "m3.medium" : { "Arch" : "HVM64" }, 
     "m3.large" : { "Arch" : "HVM64" }, 
     "m3.xlarge" : { "Arch" : "HVM64" }, 
     "m3.2xlarge" : { "Arch" : "HVM64" }, 
     "c1.medium" : { "Arch" : "PV64" }, 
     "c1.xlarge" : { "Arch" : "PV64" }, 
     "c3.large" : { "Arch" : "HVM64" }, 
     "c3.xlarge" : { "Arch" : "HVM64" }, 
     "c3.2xlarge" : { "Arch" : "HVM64" }, 
     "c3.4xlarge" : { "Arch" : "HVM64" }, 
     "c3.8xlarge" : { "Arch" : "HVM64" }, 
     "c4.large" : { "Arch" : "HVM64" }, 
     "c4.xlarge" : { "Arch" : "HVM64" }, 
     "c4.2xlarge" : { "Arch" : "HVM64" }, 
     "c4.4xlarge" : { "Arch" : "HVM64" }, 
     "c4.8xlarge" : { "Arch" : "HVM64" }, 
     "g2.2xlarge" : { "Arch" : "HVMG2" }, 
     "r3.large" : { "Arch" : "HVM64" }, 
     "r3.xlarge" : { "Arch" : "HVM64" }, 
     "r3.2xlarge" : { "Arch" : "HVM64" }, 
     "r3.4xlarge" : { "Arch" : "HVM64" }, 
     "r3.8xlarge" : { "Arch" : "HVM64" }, 
     "i2.xlarge" : { "Arch" : "HVM64" }, 
     "i2.2xlarge" : { "Arch" : "HVM64" }, 
     "i2.4xlarge" : { "Arch" : "HVM64" }, 
     "i2.8xlarge" : { "Arch" : "HVM64" }, 
     "hi1.4xlarge" : { "Arch" : "HVM64" }, 
     "hs1.8xlarge" : { "Arch" : "HVM64" }, 
     "cr1.8xlarge" : { "Arch" : "HVM64" }, 
     "cc2.8xlarge" : { "Arch" : "HVM64" } 
    } 
, 
    "AWSRegionArch2AMI" : { 
     "us-east-1"  : {"PV64" : "ami-8e682ce6", "HVM64" : "ami-146e2a7c", "HVMG2" : "ami-7200461a"}, 
     "us-west-2"  : {"PV64" : "ami-9fc29baf", "HVM64" : "ami-dfc39aef", "HVMG2" : "ami-0b78203b"}, 
     "us-west-1"  : {"PV64" : "ami-f49089b1", "HVM64" : "ami-42908907", "HVMG2" : "ami-244b5361"}, 
     "eu-west-1"  : {"PV64" : "ami-7b3db00c", "HVM64" : "ami-9d23aeea", "HVMG2" : "ami-4d7cf03a"}, 
     "eu-central-1"  : {"PV64" : "ami-0600331b", "HVM64" : "ami-04003319", "HVMG2" : "NOT_SUPPORTED"}, 
     "ap-northeast-1" : {"PV64" : "ami-3c87993d", "HVM64" : "ami-18869819", "HVMG2" : "ami-2e90892f"}, 
     "ap-southeast-1" : {"PV64" : "ami-58ba910a", "HVM64" : "ami-96bb90c4", "HVMG2" : "ami-3e78526c"}, 
     "ap-southeast-2" : {"PV64" : "ami-1500742f", "HVM64" : "ami-d50773ef", "HVMG2" : "ami-315e2a0b"}, 
     "sa-east-1"  : {"PV64" : "ami-fd9925e0", "HVM64" : "ami-af9925b2", "HVMG2" : "NOT_SUPPORTED"}, 
     "cn-north-1"  : {"PV64" : "ami-8a1d8fb3", "HVM64" : "ami-981d8fa1", "HVMG2" : "NOT_SUPPORTED"} 
    } 

    }, 

    "Resources" : { 
    "ElasticSearchBackups" : { 
     "Type" : "AWS::S3::Bucket", 
     "Properties":{ 
     "AccessControl":"PublicRead" 
     } 
    }, 

    "ElasticSearchELB" : { 
     "Type" : "AWS::ElasticLoadBalancing::LoadBalancer", 
     "Properties" :{ 
     "AvailabilityZones" : ["us-east-1c"], 
     "Instances" : [ { "Ref" : "ElasticSearchMasterDev1" },{ "Ref" : "ElasticSearchNodeDev1" }], 
     "Listeners" : [ { 
     "LoadBalancerPort" : "443", 
     "InstancePort" : "80", 
     "Protocol" : "HTTP" 
     }], 
     "HealthCheck" : { 
      "Target" : { "Fn::Join" : [ "", ["HTTP:80/", "443", "/"]]}, 
      "HealthyThreshold" : "3", 
      "UnhealthyThreshold" : "5", 
      "Interval" : "30", 
      "Timeout" : "5" 
     } 
     } 
    }, 

    "ElasticSearchMasterDev1" : { 
     "Type" : "AWS::EC2::Instance", 
     "Properties" : { 
     "AvailabilityZone": "us-east-1c", 
     "InstanceType": "m3.xlarge", 
     "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 
     "KeyName" : { "Ref" : "KeyName" }, 
     "ImageId" : "ami-4e3a6226", 
     "Monitoring": "true", 
     "DisableApiTermination": "false", 
     "IamInstanceProfile": [{"Ref": "RootInstanceProfile"}], 
     "BlockDeviceMappings": [{ 
      "DeviceName" : "/dev/sdf", 
      "Ebs" : { 
       "DeleteOnTermination" : "true", 
       "VolumeSize" : "80" 
      } 
     }], 
     "UserData": { "Fn::Base64" : { "Fn::Join" : ["", 
     [ 
      "---\n", 
      "hostname: esm1-dev.n.chronotrack.com\n", 
      "run_list:recipe[ct-server-base::default]\n" 
     ]]}}, 
     "Tags": [{"Key": "Name", "Value": "esm1-dev"}] 
     } 
    }, 


    "ElasticSearchNodeDev1" : { 
     "Type" : "AWS::EC2::Instance", 
     "Properties" : { 
     "AvailabilityZone": "us-east-1c", 
     "InstanceType": "m3.xlarge", 
     "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 
     "KeyName" : { "Ref" : "KeyName" }, 
     "ImageId" : "ami-4e3a6226", 
     "Monitoring": "true", 
     "DisableApiTermination": "false", 
     "IamInstanceProfile": [{"Ref": "RootInstanceProfile"}], 
     "BlockDeviceMappings": [{ 
      "DeviceName" : "/dev/sdf", 
      "Ebs" : { 
       "DeleteOnTermination" : "true", 
       "VolumeSize" : "80" 
      } 
     }], 
     "UserData": { "Fn::Base64" : { "Fn::Join" : ["", 
     [ 
      "---\n", 
      "hostname: esn1-dev.n.chronotrack.com\n", 
      "run_list:recipe[ct-server-base::default]\n" 
     ]]}}, 
     "Tags": [{"Key": "Name", "Value": "esn1-dev"}] 
     } 
    }, 

    "InstanceSecurityGroup" : { 
     "Type" : "AWS::EC2::SecurityGroup", 
     "Properties" : { 
     "GroupDescription" : "Enable SSH access via port 22", 
     "SecurityGroupIngress" : [ { 
      "IpProtocol" : "tcp", 
      "FromPort" : "22", 
      "ToPort" : "22", 
      "CidrIp" : { "Ref" : "SSHLocation"} 
     }, 
     { 
      "IpProtocol" : "tcp", 
      "FromPort" : "9300", 
      "ToPort" : "9300", 
      "CidrIp" : { "Ref" : "SSHLocation"} 
     } , 
     { 
      "IpProtocol" : "tcp", 
      "FromPort" : "80", 
      "ToPort" : "80", 
      "CidrIp" : { "Ref" : "SSHLocation"} 
     }, 
     { 
      "IpProtocol" : "tcp", 
      "FromPort" : "8080", 
      "ToPort" : "8080", 
      "CidrIp" : { "Ref" : "SSHLocation"} 
     }, 
     { 
      "IpProtocol" : "tcp", 
      "FromPort" : "443", 
      "ToPort" : "443", 
      "CidrIp" : { "Ref" : "SSHLocation"} 
     }] 
     } 
    }, 

     "ElasticSearchRole":{ 
     "Type":"AWS::IAM::Role", 
     "Properties":{ 
      "Path":"/", 
      "AssumeRolePolicyDocument":{ 
       "Version":"2012-10-17", 
       "Statement":[{ 
       "Effect":"Allow", 
       "Principal":{"Service":["ec2.amazonaws.com"]}, 
       "Action":["sts:AssumeRole"] 
       }] 
      } 
     } 
     }, 
     "RolePolicies":{ 
     "Type":"AWS::IAM::Policy", 
     "Properties":{ 
      "Roles":[{"Ref": "ElasticSearchRole"}], 
      "PolicyName":"root", 
      "PolicyDocument":{ 
       "Version":"2012-10-17", 
       "Statement":[{ 
        "Action" : "s3:*", 
        "Effect" : "Allow", 
        "Resource" : { "Fn::Join" : [ "", [ "arn:aws:s3:::", { "Ref" : "ElasticSearchBackups" } , "-userdata/*" ] ] } 
        }] 
      } 
     } 
     }, 

    "RootInstanceProfile":{ 
     "Type":"AWS::IAM::InstanceProfile", 
     "Properties":{ 
      "Path":"/", 
      "Roles":[{"Ref":"ElasticSearchRole"}] 
     } 
    } 
    } 
} 
+0

пожалуйста, вы можете [упростить код, чтобы дать минимальный пример] (HTTP: //stackoverflow.com/help/mcve)? – tedder42

ответ

1

Это был

"IamInstanceProfile": [{"Ref": "RootInstanceProfile"}], 

должен быть

"IamInstanceProfile": {"Ref": "RootInstanceProfile"}, 
Смежные вопросы