github.com/keikoproj/manny@v0.0.0-20210726112440-8571e4c99ced/examples/complex/templates/template.yaml (about)

     1  AWSTemplateFormatVersion: 2010-09-09
     2  Description: Creates Custom VPC
     3  Metadata:
     4    Name: chp-vpc-custom
     5    Version: 0.2.3
     6    AWS::CloudFormation::Interface:
     7      ParameterGroups:
     8        - Label:
     9            default: VPC Name
    10          Parameters:
    11            - VpcName
    12        - Label:
    13            default: >-
    14              Subnet Configuration:
    15              VPC size CAN NOT EXCEED /16 or 65,534 IP addresses.
    16              For example: The stack would not get created if you pick 6XL (/18) for both private
    17              and alternate subnets. 6XL means 16k IP addresses and it would try to create 3 private
    18              subnets and 3 alternate subnets each with 16k IP addresses, which adds up to 98k IP addresses.
    19          Parameters:
    20            - PrivateSubnetSize
    21            - DataSubnetSize
    22            - IngressSubnetSize
    23            - EgressSubnetSize
    24        - Label:
    25            default: Alternate Subnet Configuration (optional)
    26          Parameters:
    27            - AlternateSubnetName
    28            - AlternateSubnetSize
    29            - AlternateSubnetRouteTableName
    30  
    31      ParameterLabels:
    32        VpcName:
    33          default: VPC name
    34        PrivateSubnetSize:
    35          default: Size of the private subnet(s)
    36        DataSubnetSize:
    37          default: Size of the data subnet(s)
    38        AlternateSubnetName:
    39          default: Alternate subnet name
    40        AlternateSubnetSize:
    41          default: Size of the Alternate subnet(s)
    42        AlternateSubnetRouteTableName:
    43          default: Alternate subnet route table name
    44        IngressSubnetSize:
    45          default: Size of the Ingress subnet(s)
    46        EgressSubnetSize:
    47          default: Size of theEgress subnet(s)
    48  
    49  Parameters:
    50    VpcName:
    51      Type: String
    52    PrivateSubnetSize:
    53      Type: String
    54      Default: M
    55      AllowedValues:
    56        - 2XS
    57        - XS
    58        - S
    59        - M
    60        - L
    61        - XL
    62        - 2XL
    63        - 3XL
    64        - 4XL
    65        - 5XL
    66        - 6XL
    67      Description: >-
    68        Size "2XS" supports up to 48 App/Web EC2 instances, Lambda functions or EMR clusters, Size "XS" supports 96 (2 * 2XS),
    69        "S" supports 192 (2 * XS), and so on.
    70    DataSubnetSize:
    71      Type: String
    72      Default: XS
    73      AllowedValues:
    74        - 2XS
    75        - XS
    76        - S
    77        - M
    78        - L
    79        - XL
    80        - 2XL
    81        - 3XL
    82        - 4XL
    83        - 5XL
    84        - 6XL
    85      Description: >-
    86        Size "2XS" can support 48 RDS/EC2 instances or ElastiCache clusters, Size "XS" supports 96 (2 * 2XS) RDS/EC2 instances or
    87        ElastiCache clusters, "S" supports 192 (2 * XS), and so on.
    88    AlternateSubnetName:
    89      Type: String
    90      Default: ""
    91      Description: >-
    92        Alternate subnet name
    93    AlternateSubnetSize:
    94      Type: String
    95      Default: XS
    96      AllowedValues:
    97        - 2XS
    98        - XS
    99        - S
   100        - M
   101        - L
   102        - XL
   103        - 2XL
   104        - 3XL
   105        - 4XL
   106        - 5XL
   107        - 6XL
   108      Description: >-
   109        Size "2XS" supports up to 48 App/Web EC2 instances, Lambda functions or EMR clusters, Size "XS" supports 96 (2 * 2XS),
   110        "S" supports 192 (2 * XS), and so on.
   111    IngressSubnetSize:
   112      Type: String
   113      Default: XL
   114      AllowedValues:
   115        - S
   116        - M
   117        - L
   118        - XL
   119        - 2XL
   120      Description: >-
   121        Size "XL" supports up to 200 ELBs and "2XL" supports up to 400 (2 * XL) ELBs.
   122    EgressSubnetSize:
   123      Type: String
   124      Default: XS
   125      AllowedValues:
   126        - XS
   127      Description: >-
   128        Egress subnets house NAT/Internet gateways. 96 private IP addresses are available for NAT/Internet gateways.
   129    AlternateSubnetRouteTableName:
   130      Type: String
   131      Default: replication
   132      AllowedValues:
   133        - ingress
   134        - egress
   135        - private
   136        - data
   137        - replication
   138      Description: >-
   139        Name of the alternate subnet route table
   140  
   141  Mappings:
   142    EnvMap:
   143      Development:
   144        AdminAccountId: 124755957763
   145        AdminRegion: "us-west-2"
   146      Production:
   147        AdminAccountId: 427900722408
   148        AdminRegion: "us-west-2"
   149    CidrMap:
   150      2XS:
   151        SubnetSize: "28"
   152      XS:
   153        SubnetSize: "27"
   154      S:
   155        SubnetSize: "26"
   156      M:
   157        SubnetSize: "25"
   158      L:
   159        SubnetSize: "24"
   160      XL:
   161        SubnetSize: "23"
   162      2XL:
   163        SubnetSize: "22"
   164      3XL:
   165        SubnetSize: "21"
   166      4XL:
   167        SubnetSize: "20"
   168      5XL:
   169        SubnetSize: "19"
   170      6XL:
   171        SubnetSize: "18"
   172  
   173  Conditions:
   174    CreateAlternateSubnet: !Not [!Equals [!Ref AlternateSubnetName, ""]]
   175  
   176  Resources:
   177    uuidGenerator:
   178      Type: Custom::uuidGenerator
   179      Properties:
   180        ServiceToken:
   181          Fn::Sub:
   182            - arn:aws:sns:${AWS::Region}:${AccountId}:uuid-generator-prd
   183            - { AccountId: !FindInMap [EnvMap, Production, AdminAccountId] }
   184        Account: !Sub ${AWS::AccountId}
   185  
   186    AppCiRequester:
   187      Type: Custom::AppCiRequester
   188      Properties:
   189        ServiceToken:
   190          Fn::Sub:
   191            - arn:aws:sns:${AWS::Region}:${AccountId}:aws-vpn-appci-prd
   192            - { AccountId: !FindInMap [EnvMap, Production, AdminAccountId] }
   193        AccountId: !Sub ${AWS::AccountId}
   194        SessionId: !GetAtt uuidGenerator.SessionID
   195  
   196    VpcCidrAllocator:
   197      Type: Custom::VpcCidrAllocator
   198      Properties:
   199        ServiceToken:
   200          Fn::Sub:
   201            - arn:aws:sns:${AWS::Region}:${AccountId}:aws-vpn-cidr-prd
   202            - { AccountId: !FindInMap [EnvMap, Production, AdminAccountId] }
   203        Account: !Sub ${AWS::AccountId}
   204        Region: !Sub ${AWS::Region}
   205        Private: !FindInMap [CidrMap, !Ref PrivateSubnetSize, SubnetSize]
   206        Data: !FindInMap [CidrMap, !Ref DataSubnetSize, SubnetSize]
   207        Alternate: !If
   208          - CreateAlternateSubnet
   209          - !FindInMap [CidrMap, !Ref AlternateSubnetSize, SubnetSize]
   210          - "0"
   211        Ingress: !FindInMap [CidrMap, !Ref IngressSubnetSize, SubnetSize]
   212        Egress: !FindInMap [CidrMap, !Ref EgressSubnetSize, SubnetSize]
   213        SessionId: !GetAtt uuidGenerator.SessionID
   214        VpcOnly: "true"
   215        AppEnv: !GetAtt AppCiRequester.AppType
   216  
   217    VpcStack:
   218      Type: AWS::CloudFormation::Stack
   219      Properties:
   220        TemplateURL: https://s3-us-west-2.amazonaws.com/patterns-artifacts-release/vpc-v2.7.2/cf_template_master.json
   221        Parameters:
   222          CidrBlock: !GetAtt VpcCidrAllocator.VpcCidr
   223          CidrBlockPrivate: !GetAtt VpcCidrAllocator.PrivateSubnets
   224          CidrBlockIngress: !GetAtt VpcCidrAllocator.IngressSubnets
   225          CidrBlockEgress: !GetAtt VpcCidrAllocator.EgressSubnets
   226          CidrBlockData: !GetAtt VpcCidrAllocator.DataSubnets
   227          CidrBlockAlt1: !GetAtt VpcCidrAllocator.AlternateSubnets
   228          TagCfnVersion: "2.1.2"
   229          Alt1SubnetName: !If
   230            - CreateAlternateSubnet
   231            - !Ref AlternateSubnetName
   232            - !Ref "AWS::NoValue"
   233          Alt1SubnetRouteTable: !If
   234            - CreateAlternateSubnet
   235            - !Ref AlternateSubnetRouteTableName
   236            - !Ref "AWS::NoValue"
   237          CentralVpcLogAccount: "996354045376"
   238          VpcFlowLogRentention: "7"
   239          Region: !Sub ${AWS::Region}
   240          InstanceTenancy: "default"
   241          TagVpcName: !Ref VpcName
   242          TagEnv: !GetAtt AppCiRequester.AppType
   243          StackName: !Ref VpcName
   244          ArtifactBucket: patterns-artifacts-release
   245          ArtifactFolder: vpc-v2.7.2
   246  
   247  Outputs:
   248    VpcId:
   249      Value: !GetAtt VpcStack.Outputs.VpcId
   250      Description: The VPC ID