amazon-web-servicesaws-cloudformation

CloudFormation script generates "No subnets found for the default VPC"


I have seem the following error during stack creation in number of AWS provided CloudFormation script. Any idea why its generating VPC error?

Error message:

CREATE_FAILED AWS::EC2::Instance WindowsServer No subnets found for the default VPC 'vpc-aaaaaaa'. Please specify a subnet.

Here is the template: https://s3.amazonaws.com/cloudformation-templates-us-east-1/Windows_Roles_And_Features.template


Solution

  • The template works correctly (I just tried it in my account, in the Sydney region).

    It would appear that the problem lies in your Default VPC, which is created when your AWS account is setup. It has a CIDR range of 172.31.0.0/16 and should have one Public Subnet in each of your Availability Zones.

    Go to the VPC Management Console, go to the Subnets view, then change the "Filter by VPC" selector in the top-left to the Default VPC (normally un-named, so choose it via CIDR range). Make sure that you have a subnet in each Availability Zone.

    If they are missing, you can create them. Make sure you turn on Modify Auto-Assign Public IP. Alternatively, contact AWS Support and ask them to fix/recreate your Default VPC.