Skip to content
GitHubXDiscordRSS

TransitGateway

Learn how to create, update, and manage AWS EC2 TransitGateways using Alchemy Cloud Control.

The TransitGateway resource lets you manage AWS EC2 TransitGateways that enable customers to connect multiple VPCs and on-premises networks through a single gateway.

Create a basic Transit Gateway with a description and default route table settings.

import AWS from "alchemy/aws/control";
const transitGateway = await AWS.EC2.TransitGateway("myTransitGateway", {
Description: "Primary Transit Gateway for connecting VPCs",
AssociationDefaultRouteTableId: "default-route-table-id",
Tags: [
{
Key: "Name",
Value: "MyTransitGateway"
}
]
});

Configure a Transit Gateway with enhanced settings such as DNS support and multicast support.

const advancedTransitGateway = await AWS.EC2.TransitGateway("advancedTransitGateway", {
Description: "Advanced Transit Gateway with enhanced features",
DnsSupport: "enable",
MulticastSupport: "enable",
AmazonSideAsn: 64512,
TransitGatewayCidrBlocks: ["10.0.0.0/16"],
Tags: [
{
Key: "Environment",
Value: "Production"
}
]
});

Set up a Transit Gateway that automatically accepts shared attachments from other accounts.

const sharedTransitGateway = await AWS.EC2.TransitGateway("sharedTransitGateway", {
Description: "Transit Gateway with auto-accept for shared attachments",
AutoAcceptSharedAttachments: "enable",
AssociationDefaultRouteTableId: "default-route-table-id",
Tags: [
{
Key: "UseCase",
Value: "Multi-Account Setup"
}
]
});

Create a Transit Gateway that supports Equal-Cost Multi-Path (ECMP) routing for VPN connections.

const ecmpTransitGateway = await AWS.EC2.TransitGateway("ecmpTransitGateway", {
Description: "Transit Gateway with ECMP support for VPN",
VpnEcmpSupport: "enable",
TransitGatewayCidrBlocks: ["192.168.0.0/16"],
Tags: [
{
Key: "Type",
Value: "VPN"
}
]
});