aws-cloudformation/centralized_architecture/CentralizedArchitectureApplianceVpc2Az.yaml [13:180]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AWSTemplateFormatVersion: "2010-09-09"

Description: >-
  AWS CloudFormation Sample Template For Appliance VPC Setup in Centralized
  Archite For Gateway Load Balancer (GWLB). It creates a hairpin setup using
  iptables. Appliance VPC is created in the same account as Spoke VPCs and
  Transit Gateay.
  
  This template creates:
    - 1 VPC
    - 1 IGW
    - 2 NAT gateways
    - 6 subnets, 3 in each Availability Zone (AZ)
    - 6 route tables, 3 in each AZ
    - 1 Security group
      - port 22 access
      - port 80 access
      - All TCP, UDP and ICMP from VPC CIDR
    - 2 Amazon Linux 2 instances acting as appliance in each AZ. 
      Registered as targets behind a GWLB. Configures iptables on 
      instances for hairpin setup
    - 1 Amazon Linux 2 acting as bastion host
    - 1 GWLB
    - 1 Target group for GWLB 
    - 1 Listner for GWLB
    - 1 VPC endpoint service
    - 2 GWLB endpoints, 1 in each AZ
  
  **WARNING** This template creates one or more Amazon EC2 instances,
  GWLB, GWLB endpints and NAT gateways. You will be billed for the AWS 
  resources used if you create a stack from this template.

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
      - Label:
          default: Network Configuration
        Parameters:
          - VpcCidr
          - AvailabilityZone1
          - TgwAttachSubnet1Cidr
          - ApplianceSubnet1Cidr
          - NatgwSubnet1Cidr
          - AvailabilityZone2
          - TgwAttachSubnet2Cidr
          - ApplianceSubnet2Cidr
          - NatgwSubnet2Cidr
      - Label:
          default: Appliance Configuration
        Parameters:
          - ApplianceInstanceType
          - ApplianceInstanceAmiId          
          - ApplianceInstanceDiskSize
          - KeyPairName
          - AccessLocation          
      - Label:
          default: Gateway Load Balancer Configuration
        Parameters:
          - GwlbName
          - TargetGroupName
          - HealthPort
          - HealthProtocol          
      - Label:
          default: Appliance VPC Route Table Configuration
        Parameters:
          - Spoke1VpcCidr
          - Spoke2VpcCidr

    ParameterLabels:
      VpcCidr:
        default: Appliance VPC - Network CIDR for VPC   
      AvailabilityZone1:
        default: Appliance VPC - Availability Zone 1
      TgwAttachSubnet1Cidr:
        default: Appliance VPC - TGW Attachment Subnet 1 CIDR in AZ1
      ApplianceSubnet1Cidr:
        default: Appliance VPC - Appliance Subnet 1 CIDR in AZ1
      NatgwSubnet1Cidr:
        default: Appliance VPC - NAT GW Subnet 1 CIDR in AZ1
      AvailabilityZone2:
        default: Availability Zone 2        
      TgwAttachSubnet2Cidr:
        default: Appliance VPC - TGW Attachment Subnet 2 CIDR in AZ2
      ApplianceSubnet2Cidr:
        default: Appliance VPC - Appliance Subnet 2 CIDR in AZ2
      NatgwSubnet2Cidr:
        default: Appliance VPC - NAT GW Subnet 2 CIDR in AZ2
      ApplianceInstanceType:
        default: Appliance Instance Type
      ApplianceInstanceAmiId:
        default: Latest AMI ID for appliance (ec2 instance)        
      ApplianceInstanceDiskSize:
        default: Appliance Instance Size in GB
      KeyPairName:
        default: KeyPair required for accessing Appliance instance
      AccessLocation:
        default: Network CIDR to access Appliance instance
      Spoke1VpcCidr:
        default: Spoke1 VPC Network CIDR
      Spoke2VpcCidr:
        default: Spoke2 VPC Network CIDR       
      GwlbName:
        default: Appliance VPC - Gateway Load Balancer Name
      TargetGroupName:
        default: Appliance VPC - Target Group Name
      HealthPort:
        default: Appliance VPC - Health Check Port
      HealthProtocol:
        default: Appliance VPC - Health Check Protocol   

Parameters:
  VpcCidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.0/24
    Description: Appliance VPC - CIDR block for the VPC
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/y
  AvailabilityZone1:
    Description: Appliance VPC - Availability Zone 1
    Type: AWS::EC2::AvailabilityZone::Name
    ConstraintDescription: Valid Availability Zone Id
  TgwAttachSubnet1Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.0/28
    Description: Appliance VPC - TGW Attachment Subnet 1 CIDR in AZ1
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  ApplianceSubnet1Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.16/28
    Description: Appliance VPC - Appliance Subnet 1 CIDR in AZ1
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  NatgwSubnet1Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.32/28
    Description: Appliance VPC - NAT GW Subnet 1 CIDR in AZ1
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28    
  AvailabilityZone2:
    Description: Appliance VPC - Availability Zone 2
    Type: AWS::EC2::AvailabilityZone::Name
    ConstraintDescription: Valid Availability Zone Id
  TgwAttachSubnet2Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.48/28
    Description: Appliance VPC - TGW Attachment Subnet 2 CIDR in AZ2
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  ApplianceSubnet2Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.64/28
    Description: Appliance VPC - Appliance Subnet 2 CIDR in AZ2
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  NatgwSubnet2Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.80/28
    Description: Appliance VPC - NAT GW Subnet 2 CIDR in AZ2
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  ApplianceInstanceType:
    Description: Select EC2 instance type for Appliance instance. Default is set to t2.micro
    Default: t2.micro
    AllowedValues:
      - t2.micro
    Type: String
  ApplianceInstanceAmiId:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



aws-cloudformation/centralized_architecture/nested-stack/ApplianceVpc2Az.yaml [13:180]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AWSTemplateFormatVersion: "2010-09-09"

Description: >-
  AWS CloudFormation Sample Template For Appliance VPC Setup in Centralized
  Archite For Gateway Load Balancer (GWLB). It creates a hairpin setup using
  iptables. Appliance VPC is created in the same account as Spoke VPCs and
  Transit Gateay.
  
  This template creates:
    - 1 VPC
    - 1 IGW
    - 2 NAT gateways
    - 6 subnets, 3 in each Availability Zone (AZ)
    - 6 route tables, 3 in each AZ
    - 1 Security group
      - port 22 access
      - port 80 access
      - All TCP, UDP and ICMP from VPC CIDR
    - 2 Amazon Linux 2 instances acting as appliance in each AZ. 
      Registered as targets behind a GWLB. Configures iptables on 
      instances for hairpin setup
    - 1 Amazon Linux 2 acting as bastion host
    - 1 GWLB
    - 1 Target group for GWLB 
    - 1 Listner for GWLB
    - 1 VPC endpoint service
    - 2 GWLB endpoints, 1 in each AZ
  
  **WARNING** This template creates one or more Amazon EC2 instances,
  GWLB, GWLB endpints and NAT gateways. You will be billed for the AWS 
  resources used if you create a stack from this template.

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
      - Label:
          default: Network Configuration
        Parameters:
          - VpcCidr
          - AvailabilityZone1
          - TgwAttachSubnet1Cidr
          - ApplianceSubnet1Cidr
          - NatgwSubnet1Cidr
          - AvailabilityZone2
          - TgwAttachSubnet2Cidr
          - ApplianceSubnet2Cidr
          - NatgwSubnet2Cidr
      - Label:
          default: Appliance Configuration
        Parameters:
          - ApplianceInstanceType
          - ApplianceInstanceAmiId          
          - ApplianceInstanceDiskSize
          - KeyPairName
          - AccessLocation          
      - Label:
          default: Gateway Load Balancer Configuration
        Parameters:
          - GwlbName
          - TargetGroupName
          - HealthPort
          - HealthProtocol          
      - Label:
          default: Appliance VPC Route Table Configuration
        Parameters:
          - Spoke1VpcCidr
          - Spoke2VpcCidr

    ParameterLabels:
      VpcCidr:
        default: Appliance VPC - Network CIDR for VPC   
      AvailabilityZone1:
        default: Appliance VPC - Availability Zone 1
      TgwAttachSubnet1Cidr:
        default: Appliance VPC - TGW Attachment Subnet 1 CIDR in AZ1
      ApplianceSubnet1Cidr:
        default: Appliance VPC - Appliance Subnet 1 CIDR in AZ1
      NatgwSubnet1Cidr:
        default: Appliance VPC - NAT GW Subnet 1 CIDR in AZ1
      AvailabilityZone2:
        default: Availability Zone 2        
      TgwAttachSubnet2Cidr:
        default: Appliance VPC - TGW Attachment Subnet 2 CIDR in AZ2
      ApplianceSubnet2Cidr:
        default: Appliance VPC - Appliance Subnet 2 CIDR in AZ2
      NatgwSubnet2Cidr:
        default: Appliance VPC - NAT GW Subnet 2 CIDR in AZ2
      ApplianceInstanceType:
        default: Appliance Instance Type
      ApplianceInstanceAmiId:
        default: Latest AMI ID for appliance (ec2 instance)        
      ApplianceInstanceDiskSize:
        default: Appliance Instance Size in GB
      KeyPairName:
        default: KeyPair required for accessing Appliance instance
      AccessLocation:
        default: Network CIDR to access Appliance instance
      Spoke1VpcCidr:
        default: Spoke1 VPC Network CIDR
      Spoke2VpcCidr:
        default: Spoke2 VPC Network CIDR       
      GwlbName:
        default: Appliance VPC - Gateway Load Balancer Name
      TargetGroupName:
        default: Appliance VPC - Target Group Name
      HealthPort:
        default: Appliance VPC - Health Check Port
      HealthProtocol:
        default: Appliance VPC - Health Check Protocol   

Parameters:
  VpcCidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.0/24
    Description: Appliance VPC - CIDR block for the VPC
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/y
  AvailabilityZone1:
    Description: Appliance VPC - Availability Zone 1
    Type: AWS::EC2::AvailabilityZone::Name
    ConstraintDescription: Valid Availability Zone Id
  TgwAttachSubnet1Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.0/28
    Description: Appliance VPC - TGW Attachment Subnet 1 CIDR in AZ1
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  ApplianceSubnet1Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.16/28
    Description: Appliance VPC - Appliance Subnet 1 CIDR in AZ1
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  NatgwSubnet1Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.32/28
    Description: Appliance VPC - NAT GW Subnet 1 CIDR in AZ1
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28    
  AvailabilityZone2:
    Description: Appliance VPC - Availability Zone 2
    Type: AWS::EC2::AvailabilityZone::Name
    ConstraintDescription: Valid Availability Zone Id
  TgwAttachSubnet2Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.48/28
    Description: Appliance VPC - TGW Attachment Subnet 2 CIDR in AZ2
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  ApplianceSubnet2Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.64/28
    Description: Appliance VPC - Appliance Subnet 2 CIDR in AZ2
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  NatgwSubnet2Cidr:
    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])(\\/(1[6-9]|2[0-8]))$"
    Default: 192.168.1.80/28
    Description: Appliance VPC - NAT GW Subnet 2 CIDR in AZ2
    Type: String
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  ApplianceInstanceType:
    Description: Select EC2 instance type for Appliance instance. Default is set to t2.micro
    Default: t2.micro
    AllowedValues:
      - t2.micro
    Type: String
  ApplianceInstanceAmiId:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



