AWS CloudFormation lists Availability Zones for a specified region

April 6th, 2017 Posted by Blog, DevOps, Tips 0 thoughts on “AWS CloudFormation lists Availability Zones for a specified region”

Use the the intrinsic function Fn::GetAZs to returns an array that lists Availability Zones for a specified region.

Because you have access to different Availability Zones, the intrinsic function Fn::GetAZs enables CloudFormation template authors to write templates that adapt to the calling user’s access.

That way you don’t have to hard-code a full list of Availability Zones for a specified region.

Important Note: For the EC2-VPC platform, the Fn::GetAZs function returns only Availability Zones that have a default subnet unless none of the Availability Zones has a default subnet; in that case, all Availability Zones are returned.

More information on the AWS User Guide.

Continuous S.A.
Avenue des Hauts-Fourneaux 9
L-4362 Esch-sur-Alzette
Luxembourg

© Continuous S.A. 2017