gpt4 book ai didi

json - CloudFormation AWS::EC2::Instance 指定实例数量

转载 作者:行者123 更新时间:2023-12-02 04:42:22 24 4
gpt4 key购买 nike

AWS::EC2::Instance 下的 json 模板中是否可以指定实例数量?

最佳答案

您可以使用固定大小的自动缩放组:

"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"}]
}
}

以及所需的启动配置,例如:

"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"
}
}

顺便说一句 - 直到上周才可以通过仪表板使用此功能。

关于json - CloudFormation AWS::EC2::Instance 指定实例数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20576890/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com