Skip to content
GitHubXDiscord

VPNGatewayRoutePropagation

The VPNGatewayRoutePropagation resource allows you to manage route propagation for a virtual private network (VPN) gateway in AWS. This resource is crucial for ensuring that routes from your VPN connection are properly propagated to your route tables. For more information, see the AWS EC2 VPNGatewayRoutePropagations documentation.

Create a basic VPN Gateway Route Propagation with required properties:

import AWS from "alchemy/aws/control";
const vpnGatewayRoutePropagation = await AWS.EC2.VPNGatewayRoutePropagation("myVpnRoutePropagation", {
RouteTableIds: ["rtb-12345678", "rtb-87654321"],
VpnGatewayId: "vgw-abcdefgh",
adopt: true // If true, adopt existing resource instead of failing when resource already exists
});

Set up a VPN Gateway Route Propagation with additional properties and configurations:

const advancedVpnGatewayRoutePropagation = await AWS.EC2.VPNGatewayRoutePropagation("advancedVpnRoutePropagation", {
RouteTableIds: ["rtb-12345678", "rtb-87654321"],
VpnGatewayId: "vgw-abcdefgh",
adopt: false // Default is false, will fail if resource already exists
});

You can propagate routes to multiple route tables simultaneously by specifying multiple IDs:

const multiRouteTablePropagation = await AWS.EC2.VPNGatewayRoutePropagation("multiRouteTablePropagation", {
RouteTableIds: [
"rtb-12345678",
"rtb-23456789",
"rtb-34567890"
],
VpnGatewayId: "vgw-ijklmnop",
adopt: true // Adopt existing resource
});

Configure a cleanup process that removes the VPN Gateway Route Propagation when it’s no longer needed:

const cleanupVpnGatewayRoutePropagation = await AWS.EC2.VPNGatewayRoutePropagation("cleanupVpnRoutePropagation", {
RouteTableIds: ["rtb-12345678"],
VpnGatewayId: "vgw-qrstuvwx",
adopt: false // Will not adopt existing resource, will fail if it exists
});