AWS: Why did I get this error: "Template error: Fn::Select cannot select nonexistent value at index" when deploying the Kion VPC template in AWS?


The Kion provided VPC template (vpc-3az-3nat.json) leverages the AWS CloudFormation Fn::Select function in conjunction with the Fn::GetAZs function in order to work across regions and dynamically populate the availability zones to use within the deployment region.

There are two primary reasons that the template will during deployment on the Fn::Select function with this error. 

First, you may be trying to deploy the template in a region that does not have 3 availability zones. 

Second, if subnets have been removed from the default VPC in a region so that there are subnets in less than 3 availability zones the error will occur.  This failure would be due to the fact that the Fn::GetAZs function returns a list of Availability Zones that have a subnet in the default VPC for a given region.

If the default VPC is deleted completely from a region, all Availability Zones will be returned by the GetAZs function and the template should not fail with this error. 

GetAZs Function Reference