CustomerGateway
Learn how to create, update, and manage AWS EC2 CustomerGateways using Alchemy Cloud Control.
The CustomerGateway resource allows you to manage AWS EC2 CustomerGateways which are used to set up a VPN connection between your network and AWS.
Minimal Example
Section titled “Minimal Example”Create a basic CustomerGateway with required properties and a common optional property.
import AWS from "alchemy/aws/control";
const customerGateway = await AWS.EC2.CustomerGateway("MyCustomerGateway", { Type: "ipsec.1", IpAddress: "203.0.113.5", BgpAsn: 65000});
Advanced Configuration
Section titled “Advanced Configuration”Configure a CustomerGateway with additional properties such as BGP ASN and tags.
const advancedCustomerGateway = await AWS.EC2.CustomerGateway("AdvancedCustomerGateway", { Type: "ipsec.1", IpAddress: "203.0.113.10", BgpAsn: 65001, Tags: [ { Key: "Name", Value: "Advanced-Customer-Gateway" }, { Key: "Environment", Value: "Production" } ], CertificateArn: "arn:aws:acm:us-east-1:123456789012:certificate/abcd1234-efgh-5678-ijkl-9012mnopqrst"});
Using BGP ASN Extended
Section titled “Using BGP ASN Extended”Create a CustomerGateway with extended BGP ASN for specific routing needs.
const extendedBgpCustomerGateway = await AWS.EC2.CustomerGateway("ExtendedBgpCustomerGateway", { Type: "ipsec.1", IpAddress: "203.0.113.15", BgpAsn: 65002, BgpAsnExtended: 65002 // Extended BGP ASN for more specific routing});
Adoption of Existing Resources
Section titled “Adoption of Existing Resources”Use the adopt property to avoid failure when the resource already exists.
const existingCustomerGateway = await AWS.EC2.CustomerGateway("ExistingCustomerGateway", { Type: "ipsec.1", IpAddress: "203.0.113.20", adopt: true // Adopt existing resource instead of failing});