2
votes

I have seem the following error during stack creation in number of AWS provided Cloud formation 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

2
The template doesnt have the option to allow me to specify a subnet. I do have subnets created for my VPC.minisch

2 Answers

3
votes

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.

2
votes

I was facing the same problem and the below steps helped me.

  1. Deleted the subnet of the vcp the error was referring to
  2. Used this command on my shell to create a default subnet

    aws ec2 create-default-subnet --availability-zone us-east-2a

For details please visit this documentation page by Amazon