├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── lambda.zip ├── transit-gateway-association.yaml └── transit-gateway.yaml /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional 4 | documentation, we greatly value feedback and contributions from our community. 5 | 6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary 7 | information to effectively respond to your bug report or contribution. 8 | 9 | 10 | ## Reporting Bugs/Feature Requests 11 | 12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features. 13 | 14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already 15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: 16 | 17 | * A reproducible test case or series of steps 18 | * The version of our code being used 19 | * Any modifications you've made relevant to the bug 20 | * Anything unusual about your environment or deployment 21 | 22 | 23 | ## Contributing via Pull Requests 24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 25 | 26 | 1. You are working against the latest source on the *master* branch. 27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 29 | 30 | To send us a pull request, please: 31 | 32 | 1. Fork the repository. 33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 34 | 3. Ensure local tests pass. 35 | 4. Commit to your fork using clear commit messages. 36 | 5. Send us a pull request, answering any default questions in the pull request interface. 37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 38 | 39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and 40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). 41 | 42 | 43 | ## Finding contributions to work on 44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. 45 | 46 | 47 | ## Code of Conduct 48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 50 | opensource-codeofconduct@amazon.com with any additional questions or comments. 51 | 52 | 53 | ## Security issue notifications 54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. 55 | 56 | 57 | ## Licensing 58 | 59 | See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 60 | 61 | We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 11 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 12 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## AWS Transit Gateway Attachment Automation 2 | 3 | This repo contains the files that assist in the automation of Transit Gateway and Transit Gateway Attachment associations for multiple account within an AWS Organization. In addition to resource creation, an AWS Lambda function is included that creates a default route to the created Transit Gateway based upon a user set Tag value. 4 | 5 | ## Solution Overview 6 | 7 | As IT environments grow, they can become more complex, with additional accounts, VPCs, and the networking between them. AWS Transit Gateway is a service that addresses networking complexity by building a hub-and-spoke network to simplify your network routing and security. With Transit Gateway, you can connect your virtual private clouds (VPCs) that span multiple accounts and on-premises networks to a single gateway.

8 |

While Transit Gateway eases network administration and complexity, it does not address typical environment missteps such as configuration drift and multiple worker administration.

9 |

Automation through Infrastructure as Code helps combat deployment inconsistencies and assist in managing your network by templatizing your environment as a central source of truth. AWS provides a robust API that allows changes to be made quickly and to automate your environment’s processes. If you are doing a task 10 times, you can codify and automate it. This is the concept of Infrastructure as Code.

10 |

AWS CloudFormation is a service that provisions AWS resources quickly and simplifies your infrastructure management. A CloudFormation template describes the configuration of your resources, such as their property values. You can update templates to add, remove, or change the configuration of resources. This process keeps an accurate history of your resources, allowing you to track and document changes between different versions of your templates. So instead of recording changes in a ticketing system, you can reference changes in the versioning of CloudFormation templates.

11 |

CloudFormation provides a feature called StackSets, which extends the functionality of stacks by enabling you to create, update, or delete stacks across multiple accounts and Regions with a single operation. A stack set can be created in a central account, referred to as an administrator account, which provisions stacks and resource creation to target accounts.

12 |

AWS Organizations helps you centrally govern your accounts and scale your workloads on AWS. You can centrally manage billing, access control, compliance, security, and share resources across AWS accounts. Many existing AWS services take advantage of Organizations to streamline access control and management of resources.This post walks you through a solution that automates the association of transit gateway attachments to a transit gateway in a central account within your organization. It includes the following steps:

13 | 22 |

You can use the provided CloudFormation templates and code for a Lambda function to accomplish these tasks. The provided files can easily be modified to integrate in to your environment as part of your account creation and baselining.

23 |

Prerequisites

24 |

The following steps and services are instrumental in achieving this goal:

25 | 30 |

Overview of AWS Organization architecture

31 |
Figure 1: Architectural diagram

Figure 1: Architectural diagram

32 |

Using a CloudFormation template, you can create a transit gateway in a central account and then share it with your organization using AWS Resource Access Manager (AWS RAM). You then can launch a stack set that automates the creation of a transit gateway attachment.

33 |

A Lambda function gathers metadata about a VPC based on a user-provided tag value. This metadata is relevant when creating and attaching the transit gateway attachment and VPC, along with route creation to the transit gateway based on a user-provided CIDR range.

34 |

The transit gateway in the central account is configured to auto-accept peering connections and to propagate its routing table to ensure bidirectional routing.

35 |

Limitations

36 | 41 |

For more information about additional transit gateway limitations, see Limits for Your Transit Gateways.

42 |

Granting IAM permissions for stack set operations

43 |

Because stack sets perform stack operations across multiple accounts, you must have the necessary permissions defined in your AWS accounts before you can get started creating your first stack set.

44 |

In the central account, create an IAM role named AWSCloudFormationStackSetAdministrationRole. The role must have this exact name. You can do this by creating a stack from the following CloudFormation template. This role enables the following policy on your administrator account:

45 |
46 |
Json
{
 47 | 	"Version": "2012-10-17",
 48 | 	"Statement": [{
 49 | 		"Action": [
 50 | 			"sts:AssumeRole"
 51 | 		],
 52 | 		"Resource": [
 53 | 			"arn:aws:iam::*:role/AWSCloudFormationStackSetExecutionRole"
 54 | 		],
 55 | 		"Effect": "Allow"
 56 | 	}]
 57 | }
58 |

The preceding template creates the following trust relationship:

59 |
Json
{
 60 | 	"Version": "2012-10-17",
 61 | 	"Statement": [{
 62 | 		"Effect": "Allow",
 63 | 		"Principal": {
 64 | 			"Service": "cloudformation.amazonaws.com"
 65 | 		},
 66 | 		"Action": "sts:AssumeRole"
 67 | 	}]
 68 | }
69 |

In each target account, create a service role named AWSCloudFormationStackSetExecutionRole that trusts the administrator account. The role must have this exact name. You can do this by creating a stack from the following CloudFormation template. When you use this template, provide the name of the administrator account with which your target account must have a trust relationship.

70 |

Be aware that this template grants AdministratorAccess. After you use the template to create a target account execution role, you must scope the permissions in the policy statement to the types of resources that you are creating when using StackSets.

71 |

The target account service role requires permissions to perform any operations that your CloudFormation template specifies. Your target account always needs full CloudFormation permissions, which include permissions to create, update, delete, and describe stacks. The role created by this template enables the following policy on a target account:

72 |
Json
{
 73 | 	"Version": "2012-10-17",
 74 | 	"Statement": [{
 75 | 		"Effect": "Allow",
 76 | 		"Action": "*",
 77 | 		"Resource": "*"
 78 | 	}]
 79 | }
80 |

The following trust relationship is created by the template. The administrator account’s ID shows as central_account_id:

81 |
Json
{
 82 | 	"Version": "2012-10-17",
 83 | 	"Statement": [{
 84 | 		"Effect": "Allow",
 85 | 		"Principal": {
 86 | 			"AWS": "arn:aws:iam::central_account_id:root"
 87 | 		},
 88 | 		"Action": "sts:AssumeRole"
 89 | 	}]
 90 | }
91 |

You can configure the trust relationship of an existing target account execution role to trust a specific role in the administrator account. If you delete the role in the administrator account and create a new one to replace it, you must configure your target account trust relationships with the new administrator account role, represented by central_account_id in the preceding example.

92 |

Deploying the template and configuring a resource share

93 |

In the central account in which to deploy the transit gateway, open the CloudFormation console.

94 |

On the Choose a template page, choose Upload a template file and select the provided transit-gateway.yaml file to upload. Choose Next.

95 |

On the Specify stack details page, provide a stack name along with the parameter values for the following fields:

96 | 104 |

At the time of publication, you cannot change or modify these parameters. To enable or disable these parameters, you must create a new transit gateway.

105 |

For this deployment, keep the default values. You can customize these values later for your own deployment.

106 |

The Configure stack options page doesn’t require you to enter any values or configuration changes. Choose Next.

107 |

On the Review page, verify your values and stack detail and choose Create stack to deploy the transit gateway.

108 |

The template takes a few minutes to deploy and reports CREATE_COMPLETE when finished.

109 |

In the VPC console, choose Transit Gateway. This page shows your deployed transit gateways and additional metadata. In the next step, you need the Transit Gateway ID.

110 |

When the transit gateway is available, you can share it across multiple accounts, an organization, and an organizational unit using AWS RAM. In this example, you share it across an organization. A significant benefit of sharing across an organization is that you can share resources without requiring the exchange of resource share invitations.

111 |

When using Organizations to share resources across an organization or organizational unit, you must enable sharing with your organization from your organization’s master account. Sharing within your organization can only be enabled by the master account. The following steps outline this process:

112 | 118 |

Log back in to the account that contains your transit gateway. In the Resource Access Manager console, choose Create resource share.

119 |

Provide a name to the resource share. For Select resource type, choose Transit Gateways. This step populates a field where you can select your transit gateway.

120 |

Under Principals, you can add the accounts, organizational units, or your organization with which to share. This step allows you to limit what accounts can view the transit gateway as an available resource to which to attach. For this example, share with the entire organization.

121 |

Choose Create resource share. Now you have a transit gateway shared with your organization. Because you shared across the organization, you don’t have to accept sharing invitations in the child accounts.

122 |

Deploying the VPC with a template in the central account as a stack set

123 |

In the central account, create and deploy a stack set. This stack set deploys CloudFormation stacks in target accounts that create a Lambda function to perform a lookup for your VPC and its associated subnets and default route table, based upon a user-provided tag value.

124 |

You can use that information to create and attach the transit gateway attachment and VPC to each other. The transit gateway attachment becomes associated with the central account transit gateway. The target VPC’s default route table populates with a configurable route with the destination to the central account transit gateway. The transit gateway’s route table then populates routes back to the target VPC.

125 |

This example deploys a Lambda function in each target account as part of the automation of transit gateway attachments. The code is in a .zip file named lambda.zip. Upload the file to an S3 bucket that allows access permissions to the child account. Amazon S3 bucket policies support the PrincipalOrg, which allows any account that originates from the same Organizations ID to access resources from with S3.

126 |

The following is a sample S3 bucket policy to allow the GetObject and ListBucket actions within your organization. Replace S3 bucket ARN and o-id with your own resource values:

127 |
Json
{
128 | 	"Version": "2012-10-17",
129 | 	"Statement": [
130 | 		{
131 | 			"Sid": "S3AccessToTgwLambdaCode",
132 | 			"Action": [
133 | 				"s3:GetObject",
134 | 				"s3:ListBucket"
135 | 			],
136 | 			"Effect": "Allow",
137 | 			"Resource": [
138 | 				"S3 bucket ARN",
139 | 				"S3 bucket ARN/*"
140 | 			],
141 | 			"Condition": {
142 | 				"StringEquals": {
143 | 					"aws:PrincipalOrgID": "o-id"
144 | 				}
145 | 			},
146 | 			"Principal": "*"
147 | 		}
148 | 	]
149 | }
150 |

You can modify this sample policy to allow external account access, but this example locks down the policy to your organization.

151 |

In the CloudFormation console, choose StackSets, Create StackSet.

152 |

On the Choose a template page, choose Upload a template file. Select the provided transit-gateway-association.yaml file and choose Next.

153 |

On the Specify stack details page, provide a name for the stack set along with the parameter values for the following fields, then choose Next.

154 | 161 |

On the Configure StackSet options page, enter AWSCloudFormationStackSetExecutionRole for the IAM execution role name. This field should already have this value populated. You do not need an optional IAM admin role ARN. Choose Next.

162 |

In the Set deployment options screen, provide the account numbers or the organizational unit ID in which to deploy the solution. You can use either value depending on your use case. The benefit of selecting accounts is that you limit the deployment to the specific accounts in which to deploy. The organizational units deploy in all accounts within that organizational unit.

163 |

You can specify the Region or Regions that the solution deploys in for each account. You can also set deployment options to deploy one at a time, or increase the options to deploy in multiple accounts at the same time. However, transit gateways are Region-specific, and you must deploy the stack set in the same Region in which the transit gateway resides. You can further customize the template with multiple transit gateways in multiple Regions, which could have mappings defined to associate the correct transit gateway with the deployment Region.

164 |

After you enter the preceding information, choose Next.

165 |

On the following screen, verify your settings and choose Submit. This step begins the operation of deploying the stack set to the target account.

166 |

You can add additional accounts as stack instances by navigating to the console for the newly created stack set. Choose Actions, Add new stacks to StackSet, and repeat the preceding process.

167 |

Monitoring activity

168 |

After the stack set is running, you can log in to the target account. In the CloudFormation console, view the newly created stack. The Resources tab shows a list of created items.

169 |

To verify success, log in to a target account. In the VPC console, in the left navigation pane, choose Transit Gateway Attachments. You should see a transit gateway attachment associated with the transit gateway in the central account. You can navigate to your route tables and verify that a route is now in the VPC’s default route table with the transit gateway as the destination.

170 |

In the central account, in the VPC console, choose Transit Gateway Routes. There you can verify that there are routes back to the target VPCs. 

171 |

Conclusion

172 |

The provided templates serve as a starting point to build out more complex solutions that you can integrate into your environment. You can modify the stack set to handle multiple transit gateways that could reside in different Regions or for different workloads.

173 |

You can also build logic into the CloudFormation template to handle conditions and determine which transit gateways to attach to or how to construct the route tables. This process can become part of the foundation for automating your environment and network management across multiple VPCs and AWS accounts.

174 | 175 | 176 | ## License 177 | 178 | This library is licensed under the MIT-0 License. See the LICENSE file. 179 | 180 | -------------------------------------------------------------------------------- /lambda.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-transit-gateway-attachment-automation/afa232448d0be0584b6a609b4944becc96e68b48/lambda.zip -------------------------------------------------------------------------------- /transit-gateway-association.yaml: -------------------------------------------------------------------------------- 1 | # (c) 2019 Amazon Web Services, Inc. or its affiliates. All Rights Reserved. This AWS Content is provided subject to the terms of the AWS Customer 2 | # Agreement available at https://aws.amazon.com/agreement/ or other written agreement between Customer and Amazon Web Services, Inc. 3 | AWSTemplateFormatVersion: '2010-09-09' 4 | Description: Deploys an AWS Lambda Function that performs a Transit Gateway Attachment and Route creation to a centralized AWS Transit Gateway (RCS-1463) 5 | Metadata: 6 | AWS::CloudFormation::Interface: 7 | ParameterGroups: 8 | - Label: 9 | default: 'Parameter Settings' 10 | Parameters: 11 | - pVpcTag 12 | - pTransitGatewayId 13 | - pRoute 14 | - Label: 15 | default: 'Lambda Settings' 16 | Parameters: 17 | - pTGWLambdaS3Bucket 18 | - pTGWLambdaS3Key 19 | ParameterLabels: 20 | pVpcTag: 21 | default: VPC Tag 22 | pTransitGatewayId: 23 | default: Transit Gateway Id 24 | pRoute: 25 | default: Route Destination CIDR 26 | pTGWLambdaS3Bucket: 27 | default: S3 Bucket 28 | pTGWLambdaS3Key: 29 | default: S3 Key 30 | 31 | 32 | Parameters: 33 | pVpcTag: 34 | Description: VPC Tags that you would like to associate with the Transit Gateway (Comma Separated) 35 | Type: String 36 | pTransitGatewayId: 37 | Description: The ID of the Central Account Transit Gateway 38 | Type: String 39 | pRoute: 40 | Description: Destination Route for traffic to the Central Account Transit Gateway 41 | Type: String 42 | Default: '0.0.0.0/0' 43 | pTGWLambdaS3Bucket: 44 | Description: S3 Bucket for Transit Gateway Attachment Lambda Code 45 | Type: String 46 | AllowedPattern: "^[0-9a-zA-Z]+([0-9a-zA-Z-]*[0-9a-zA-Z])*$" 47 | pTGWLambdaS3Key: 48 | Description: The Key location of the Lambda zip for Transit Gateway Attachment. 49 | Type: String 50 | AllowedPattern: ^[a-zA-Z0-9[\\].\/()!:=?#,@+&;{}$-_]* 51 | 52 | 53 | Resources: 54 | rGetVpcLambdaRole: 55 | Type: AWS::IAM::Role 56 | Properties: 57 | AssumeRolePolicyDocument: 58 | Version: '2012-10-17' 59 | Statement: 60 | - Effect: Allow 61 | Principal: 62 | Service: 63 | - lambda.amazonaws.com 64 | Action: 65 | - sts:AssumeRole 66 | Path: "/" 67 | Policies: 68 | - PolicyName: TransitGatewayAttachments 69 | PolicyDocument: 70 | Version: '2012-10-17' 71 | Statement: 72 | - Effect: Allow 73 | Action: 74 | - logs:CreateLogGroup 75 | - logs:CreateLogStream 76 | - logs:PutLogEvents 77 | Resource: !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:* 78 | - Effect: Allow 79 | Action: 80 | - ec2:* 81 | - iam:ListRoles 82 | - iam:CreateServiceLinkedRole 83 | Resource: "*" 84 | 85 | rGetVpcLambda: 86 | Type: AWS::Lambda::Function 87 | DependsOn: 88 | - rGetVpcLambdaRole 89 | Properties: 90 | FunctionName: !Sub TransitGatewayAttachmentsAndRoute 91 | Role: !GetAtt rGetVpcLambdaRole.Arn 92 | Description: Captures VPC metadata for Transit Gateway Attachments 93 | Handler: index.lambda_handler 94 | Runtime: python3.6 95 | Timeout: 120 96 | Code: 97 | S3Bucket: !Ref pTGWLambdaS3Bucket 98 | S3Key: !Ref pTGWLambdaS3Key 99 | 100 | rGetVpcLambdaCustomIvoke: 101 | Type: Custom::GetVPCLambdaInvoke 102 | DependsOn: rGetVpcLambda 103 | Properties: 104 | ServiceToken: !GetAtt [ rGetVpcLambda, Arn ] 105 | Vpc_Tags: !Ref pVpcTag 106 | Account: !Sub ${AWS::AccountId} 107 | Region: !Sub ${AWS::Region} 108 | CIDR: !Ref pRoute 109 | Transit_Gateway_Id: !Ref pTransitGatewayId 110 | 111 | # Lambda permission - event rule can trigger evaluation 112 | rLambdaPermission: 113 | Type: AWS::Lambda::Permission 114 | DependsOn: rGetVpcLambda 115 | Properties: 116 | Action: lambda:InvokeFunction 117 | FunctionName: !GetAtt 'rGetVpcLambda.Arn' 118 | Principal: events.amazonaws.com 119 | -------------------------------------------------------------------------------- /transit-gateway.yaml: -------------------------------------------------------------------------------- 1 | # (c) 2017 Amazon Web Services, Inc. or its affiliates. All Rights Reserved. This AWS Content is provided subject to the terms of the AWS Customer 2 | # Agreement available at https://aws.amazon.com/agreement/ or other written agreement between Customer and Amazon Web Services, Inc. 3 | AWSTemplateFormatVersion: '2010-09-09' 4 | Description: This is the CloudFormation script for deployment of a Transit Gateway (RCS-1463) 5 | Metadata: # Metadata Section 6 | AWS::CloudFormation::Interface: 7 | ParameterGroups: # Parameter Groups 8 | - Label: # Transit Gateway Configuration 9 | default: Transit Gateway Configuration 10 | Parameters: # Label Parameters 11 | - pAmazonAsn 12 | - pAutoAcceptSharedAttachments 13 | - pDefaultRouteTableAssociation 14 | - pDefaultRouteTablePropagation 15 | - pDnsSupport 16 | - pVpnEcmpSupport 17 | 18 | ParameterLabels: # Parameter Labels 19 | pAmazonAsn: 20 | default: Amazon Side ASN 21 | pAutoAcceptSharedAttachments: 22 | default: Auto Accept Share Attachments 23 | pDefaultRouteTableAssociation: 24 | default: Auto Associate Route Table Association 25 | pDefaultRouteTablePropagation: 26 | default: Automatic Route Propagation 27 | pDnsSupport: 28 | default: DNS Support 29 | pVpnEcmpSupport: 30 | default: Equal Cost Multipath Protocol 31 | 32 | Parameters: # CloudFormation Parameters 33 | pAmazonAsn: # Amazon side BGP ASN 34 | Type: String 35 | Description: A private Autonomous System Number (ASN) for the Amazon side of a BGP session. 36 | Default: 65000 37 | MinLength: 5 38 | MaxLength: 10 39 | ConstraintDescription: The range is 64512 to 65534 for 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. 40 | 41 | pAutoAcceptSharedAttachments: # enable/disable attachment requests 42 | Type: String 43 | Description: Indicates whether cross-account attachment requests are automatically accepted. 44 | Default: "enable" 45 | AllowedValues: 46 | - "enable" 47 | - "disable" 48 | 49 | pDefaultRouteTableAssociation: # enable/disable automatic route table association 50 | Type: String 51 | Description: Enable or disable automatic association with the default association route table. 52 | Default: "enable" 53 | AllowedValues: 54 | - "enable" 55 | - "disable" 56 | 57 | pDefaultRouteTablePropagation: # enable/disable automatic route propagation to the default route table 58 | Type: String 59 | Description: Enable or disable automatic propagation of routes to the default propagation route table. 60 | Default: "enable" 61 | AllowedValues: 62 | - "enable" 63 | - "disable" 64 | 65 | pDnsSupport: # Enable or disable DNS support 66 | Type: String 67 | Description: Enable or disable DNS support. 68 | Default: "enable" 69 | AllowedValues: 70 | - "enable" 71 | - "disable" 72 | 73 | pVpnEcmpSupport: # Enable or disable Equal Cost Multipath Protocol 74 | Type: String 75 | Description: Enable or disable Equal Cost Multipath Protocol. 76 | Default: "disable" 77 | AllowedValues: 78 | - "enable" 79 | - "disable" 80 | 81 | Resources: # CloudFormation Resources 82 | rTransitGateway: 83 | Type: "AWS::EC2::TransitGateway" 84 | Properties: 85 | AmazonSideAsn: !Ref pAmazonAsn 86 | AutoAcceptSharedAttachments: !Ref pAutoAcceptSharedAttachments 87 | DefaultRouteTableAssociation: !Ref pDefaultRouteTableAssociation 88 | DefaultRouteTablePropagation: !Ref pDefaultRouteTablePropagation 89 | Description: "Transit Gateway serves as a centralized outgoing gateway for networking traffic" 90 | DnsSupport: !Ref pDnsSupport 91 | Tags: 92 | - Key: Name 93 | Value: 'My Transit Gateway' 94 | VpnEcmpSupport: !Ref pVpnEcmpSupport 95 | 96 | Outputs: 97 | oTransitGatewayId: #Outputs the Transit Gateway ID 98 | Description: The Transit Gateway ID 99 | Value: !Ref rTransitGateway 100 | --------------------------------------------------------------------------------