AWS Cloudformation Fn::GetAZs not working after timezone change

1.4k views Asked by At

I am using AWS Cloudformation to create an application that deploys some instances inside a cluster with an Autoscaling group. I'm deploying it at us-east-1

The thing is that yesterday we changed to Summertime, and my script stopped working, giving me a very weird error, because I had run the same script on Friday and it was working perfectly.

After some debugging, I found the culprit and it seems to be the intrinsic function Fn::GetAZs.

I was specifying my availability zones and subnets for the Autoscaling group and the error was:

The availability zones of the specified subnets and the Auto Scaling group do not match

After that I changed my script. Instead of having the following format:

AvailabilityZones:
     - Fn::Select:
       - '0'
       - Fn::GetAZs:
           Ref: AWS::Region
     - Fn::Select:
       - '1'
       - Fn::GetAZs:
           Ref: AWS::Region
     - Fn::Select:
       - '2'
       - Fn::GetAZs:
           Ref: AWS::Region

I used this format

AvailabilityZones:
    - us-east-1a
    - us-east-1b
    - us-east-1c

And it worked, but of course I can't have hardcoded values like that. This lead me to think that after the timezone changed it started to fail. My current location is Belo Horizonte - Brazil

Is anyone facing the same issue ? Does it make sense ?

Thanks.

1

There are 1 answers

0
Rafał Wrzeszcz On

Fn::GetAZs returns availability zones in which you have default subnets in your default VPC. Maybe you deleted such subnects.

You have two options:

  • recreate default VPC with default subnets;
  • remove default VPC entirely.

Sidenote: Fn::GetAZs works in current region if not specified, so you don't need to use

Fn::GetAZs:
    Ref: AWS::Region

You can simplify it into:

Fn::GetAZs: ""