CloudWiki
Resource

Transit Gateway

Amazon Web Services
Network
A transit gateway (TGW) is fully managed service that acts as a network transit hub used to connect virtual private clouds (VPCs) and on-premises networks through a single place, to simplify management and control over your organization connected networks while reducing operational costs.
Terraform Name
terraform
aws_ec2_transit_gateway
Transit Gateway
attributes:
  • amazon_side_asn - (Optional) Private Autonomous System Number (ASN) for the Amazon side of a BGP session. The range is 64512 to 65534 for 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. Default value: 64512.
  • auto_accept_shared_attachments - (Optional) Whether resource attachment requests are automatically accepted. Valid values: disable, enable. Default value: disable.
  • default_route_table_association - (Optional) Whether resource attachments are automatically associated with the default association route table. Valid values: disable, enable. Default value: enable.
  • default_route_table_propagation - (Optional) Whether resource attachments automatically propagate routes to the default propagation route table. Valid values: disable, enable. Default value: enable.
  • description - (Optional) Description of the EC2 Transit Gateway.
  • dns_support - (Optional) Whether DNS support is enabled. Valid values: disable, enable. Default value: enable.
  • multicast_support - (Optional) Whether Multicast support is enabled. Required to use ec2_transit_gateway_multicast_domain. Valid values: disable, enable. Default value: disable.
  • tags - (Optional) Key-value tags for the EC2 Transit Gateway. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
  • transit_gateway_cidr_blocks - (Optional) One or more IPv4 or IPv6 CIDR blocks for the transit gateway. Must be a size /24 CIDR block or larger for IPv4, or a size /64 CIDR block or larger for IPv6.
  • vpn_ecmp_support - (Optional) Whether VPN Equal Cost Multipath Protocol support is enabled. Valid values: disable, enable. Default value: enable.

Associating resources with a
Transit Gateway
Resources do not "belong" to a
Transit Gateway
Rather, one or more Security Groups are associated to a resource.
Create
Transit Gateway
via Terraform:
The following HCL creates a transit gateway
Syntax:

resource "aws_ec2_transit_gateway" "example" {
 description = "example"
}

Create
Transit Gateway
via CLI:
Parameters:

create-transit-gateway
[--description <value>]
[--options <value>]
[--tag-specifications <value>]
[--dry-run | --no-dry-run]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]

Example:

aws ec2 create-transit-gateway --description "My Transit Gateway" --options AmazonSideAsn=64512 --tag-specifications 'ResourceType=transit-gateway,Tags=[{Key=Environment,Value=Production},{Key=Owner,Value=MyTeam}]'

aws cost
Costs
Transit Gateway (TGW) charges for the amount of data transferred through the gateway and for the number of VPN and Direct Connect connections attached to the gateway. You are also charged for the amount of data processed by the gateway. The cost of using Transit Gateway can vary based on the amount of data transferred, the number of VPN and Direct Connect connections, and the amount of data processed.
Direct Cost

<Region>-TransitGateway-Bytes

Indirect Cost
No items found.
Best Practices for
Transit Gateway

Categorized by Availability, Security & Compliance and Cost

Low
Access allowed from VPN
No items found.
Low
Auto Scaling Group not in use
No items found.
Medium
Connections towards DynamoDB should be via VPC endpoints
No items found.
Medium
Container in CrashLoopBackOff state
No items found.
Low
EC2 with GPU capabilities
No items found.
Medium
EC2 with high privileged policies
No items found.
Medium
ECS cluster delete alarm
No items found.
Critical
ECS task with Admin access (*:*)
Medium
ECS task with high privileged policies
No items found.
Critical
EKS cluster delete alarm
No items found.
Medium
ElastiCache cluster delete alarm
No items found.
Medium
Ensure Container liveness probe is configured
No items found.
Medium
Ensure ECS task definition has memory limit
No items found.
Critical
Ensure EMR cluster master nodes are not publicly accessible
No items found.
More from
Amazon Web Services