I'm getting this error while trying to create a VPC with a Subnet in CloudFormation.
Subnet CREATE_FAILED Resource handler returned message: "The CIDR '10.0.1.0/22' is invalid. (Service: Ec2, Status Code: 400, Request ID: 97af4b96-80dd-4092-910c-5d11e5b9ca72, Extended Request ID: null)" (RequestToken: bed19eb5-2309-589e-98bf-9dacc656462a, HandlerErrorCode: InvalidRequest)
Here it is my VPC and Subnet setup in yaml:
VPC:
Type: 'AWS::EC2::VPC'
Properties:
CidrBlock: 10.0.2.0/24
Metadata:
'AWS::CloudFormation::Designer':
id: 45e7f38e-c4b6-4a19-9d54-b74e36ef53de
Subnet:
Type: 'AWS::EC2::Subnet'
Properties:
VpcId: !Ref VPC
CidrBlock: 10.0.1.0/22
Metadata:
'AWS::CloudFormation::Designer':
id: 58cd6d64-1f79-4dbe-a981-c9238975f154