--- AWSTemplateFormatVersion: "2010-09-09" Description: > AWS EC2 Good Template Parameters: cidrBlockAllowedPattern: Type: String AllowedPattern: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$' cidrBlockAllowedValues: Type: String AllowedValues: - '127.0.0.1/32' - '8.8.8.8/32' cidrBlockAllowedPatternValues: Type: String AllowedPattern: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$' AllowedValues: - '127.0.0.1/32' - '8.8.8.8/32' cidrBlockSsm: Type: AWS::SSM::Parameter::Value Default: /Infra/VpcCidr vpcTenancy: Type: String AllowedValues: - default - dedicated Resources: myVpc1: Type: AWS::EC2::VPC Properties: CidrBlock: !Ref cidrBlockAllowedPattern InstanceTenancy: default myVpc2: Type: AWS::EC2::VPC Properties: InstanceTenancy: !Ref vpcTenancy CidrBlock: !Ref cidrBlockAllowedPattern myVpc3: Type: AWS::EC2::VPC Properties: InstanceTenancy: !Ref vpcTenancy CidrBlock: !Ref cidrBlockAllowedValues myVpc4: Type: AWS::EC2::VPC Properties: InstanceTenancy: !Ref vpcTenancy CidrBlock: !Ref cidrBlockAllowedPatternValues myVpc5: Type: AWS::EC2::VPC Properties: InstanceTenancy: dedicated CidrBlock: !Ref cidrBlockSsm mySubnet21: Type: AWS::EC2::Subnet Properties: CidrBlock: Fn::Select: - 0 - !Cidr [!Ref cidrBlockAllowedPattern, 3, 16] VpcId: vpc-1234567 mySubnet22: Type: AWS::EC2::Subnet Properties: CidrBlock: !Ref cidrBlockAllowedPattern VpcId: vpc-1234567