Autoscaling across multiple subnets using AWS Cloudformation throws error

邮差的信 提交于 2019-12-12 19:16:31

问题


I am unable to create a Cloudformation template to autoscale across 2 different public subnets. I keep getting the error

CREATE_FAILED
AWS::AutoScaling::AutoScalingGroup
The availability zones of the specified subnets and the Auto Scaling group do not match

I have extensively researched all the different template code possibilities and I've tried them all, including

Defining the exact AZs like this:

AvailabilityZones" : [ us-west-2a, us-west-2b ],

Using the VPCZone Identifier property instead and leaving the AvailabilityZone property out of the resource:

"VPCZoneIdentifier" : [ subnet-1234, subnet-5678 ]

but here is my latest attempt:

"ASASGS3JJ": {
        "Type": "AWS::AutoScaling::AutoScalingGroup",
        "Properties": {
            "AvailabilityZones": {
                "Fn::GetAZs": ""
            },
            "InstanceId": {
                "Ref": "EC2I12Q2R"
            },
            "LoadBalancerNames": [
                "ELBLB2IQL9"
            ],
            "MaxSize": 2,
            "MinSize": 2
        },

Unfortunately still getting the same error. Can I please get some assistance on how to properly format? Do I need to change any code outside of the Autoscaling group resource?


回答1:


You need to specify your region:

"AvailabilityZones":{ "Fn::GetAZs" : { "Ref" : "AWS::Region" } }




回答2:


I ended up using a LaunchConfiguration and removing AvailabilityZones parameter. That seems to have fixed it.



来源:https://stackoverflow.com/questions/44004118/autoscaling-across-multiple-subnets-using-aws-cloudformation-throws-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!