Pregunta

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

¿Fue útil?

Solución

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.

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top