문제

Is there a way in the json template under AWS::EC2::Instance to specify the number of instances?

도움이 되었습니까?

해결책

you can use auto scaling group with fixed size:

"MyFixedSizeGroup":{
        "Type":"AWS::AutoScaling::AutoScalingGroup",
        "Properties":{
            "LaunchConfigurationName":{"Ref":"GlobalWorkersSmallLaunchConf"},
            "AvailabilityZones" : [ "us-east-1a" ],
            "MinSize":"4",
            "MaxSize":"4",
            "DesiredCapacity":"4",
            "Tags":[{"Key":"Name", "Value":"worker instance", "PropagateAtLaunch":"true"}]          
        }           
}

and the desired launch configuration, for example:

"GlobalWorkersSmallLaunchConf":{
        "Type":"AWS::AutoScaling::LaunchConfiguration",
        "Properties":{"KeyName":{"Ref":"MyKeyName"},
                      "ImageId":"ami-SomeAmi",
                      "UserData":{"Fn::Base64":{"Fn::Join":["",[{"Ref":"SomeInitScript"}]]}},
                      "SecurityGroups":[{"Ref":"InstanceSecurityGroup"}],
                      "InstanceType":"m1.small",
                      "InstanceMonitoring":"false"
        }           
}

BTW- this wasn't available through the dashboard until last week.

다른 팁

CloudFormation does not provide any feature which you cannot do from AWS Console. Can you provide number of instance to be created when you are creating it from the AWS Console? No, you cannot.

There is an option in AWS Console to specify number of instances to be created.

But, There is no such option Cloudforamtion for AWS::EC2::Instance.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top