CustomerGatewayAssociation
The CustomerGatewayAssociation resource allows you to manage AWS NetworkManager Customer Gateway Associations within your AWS environment. This resource is essential for linking customer gateways with specific devices in your global network.
Minimal Example
Section titled “Minimal Example”Create a basic Customer Gateway Association with required properties and one optional property:
import AWS from "alchemy/aws/control";
const customerGatewayAssociation = await AWS.NetworkManager.CustomerGatewayAssociation("myCustomerGatewayAssociation", { GlobalNetworkId: "gn-12345678", DeviceId: "device-123456", CustomerGatewayArn: "arn:aws:ec2:us-west-2:123456789012:customer-gateway:cgw-123456", LinkId: "link-123456" // Optional});
Advanced Configuration
Section titled “Advanced Configuration”Configure a Customer Gateway Association with the adopt flag to ensure it adopts an existing resource if present:
const advancedCustomerGatewayAssociation = await AWS.NetworkManager.CustomerGatewayAssociation("advancedCustomerGatewayAssociation", { GlobalNetworkId: "gn-87654321", DeviceId: "device-654321", CustomerGatewayArn: "arn:aws:ec2:us-west-2:123456789012:customer-gateway:cgw-654321", LinkId: "link-654321", // Optional adopt: true // Adopt existing resource if it exists});
Usage with Additional Attributes
Section titled “Usage with Additional Attributes”Demonstrate how to access additional attributes like ARN and creation time after creating the resource:
const customerGatewayAssociation = await AWS.NetworkManager.CustomerGatewayAssociation("detailedCustomerGatewayAssociation", { GlobalNetworkId: "gn-11223344", DeviceId: "device-223344", CustomerGatewayArn: "arn:aws:ec2:us-west-2:123456789012:customer-gateway:cgw-223344"});
// Access additional propertiesconsole.log(`ARN: ${customerGatewayAssociation.Arn}`);console.log(`Created At: ${customerGatewayAssociation.CreationTime}`);
Integrating with Other AWS Resources
Section titled “Integrating with Other AWS Resources”Show how to use the Customer Gateway Association in a context that involves other AWS resources, like a VPN connection:
import AWS from "alchemy/aws/control";
const customerGatewayAssociation = await AWS.NetworkManager.CustomerGatewayAssociation("vpnCustomerGatewayAssociation", { GlobalNetworkId: "gn-55667788", DeviceId: "device-778899", CustomerGatewayArn: "arn:aws:ec2:us-west-2:123456789012:customer-gateway:cgw-778899"});
// Now you can use this association to create a VPN connection or other related resourcesconst vpnConnection = await AWS.NetworkManager.VpnConnection("myVpnConnection", { CustomerGatewayId: customerGatewayAssociation.CustomerGatewayArn, VpnGatewayId: "vgw-12345678", Type: "ipsec.1"});