CloudFormation AWS EC2 :: ::实例指定实例数 [英] CloudFormation AWS::EC2::Instance specify number of instances

查看:277
本文介绍了CloudFormation AWS EC2 :: ::实例指定实例数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在根据AWS EC2 :: ::实例的JSON模板指定实例的数量?

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-这是不是可以通过仪表板直到上周。

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

这篇关于CloudFormation AWS EC2 :: ::实例指定实例数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆