AWS Direct Connect is a cloud service solution that makes it easy to establish a dedicated network connection from your premises to AWS. Using AWS Direct Connect, you can establish private connectivity between AWS and your datacenter, office, or colocation environment, which in many cases can reduce your network costs, increase bandwidth throughput, and provide a more consistent network experience than Internet-based connections.
Important Clarification: The Virtual Private Gateway in Direct Connect is NOT the same as a VPN Gateway, though they share similar naming!
In Direct Connect Context:
Key Difference from VPN:
AWS partner facilities where AWS equipment is collocated. These are third-party data centers where you can connect to AWS infrastructure.
Logical connections that allow you to access AWS services. Can be public (for AWS public services) or private (for VPC resources).
Allows you to connect your Direct Connect connection to multiple VPCs across different AWS regions.
The AWS side of a VPN connection that connects your VPC to your Direct Connect connection.
Benefit | Description | Use Case |
---|---|---|
Reduced Network Costs | Lower data transfer rates compared to internet-based connections | High-volume data transfers |
Consistent Performance | Dedicated bandwidth with predictable performance | Real-time applications, video streaming |
Enhanced Security | Private connection that doesn't traverse the public internet | Sensitive data transfers, compliance requirements |
Hybrid Cloud | Seamless integration between on-premises and AWS | Gradual cloud migration, hybrid architectures |
Dedicated Connection: Physical ethernet connection dedicated to you. You work directly with AWS to establish the connection.
Hosted Connection: Provisioned through an AWS Direct Connect Partner. The partner owns the physical connection and provides you with a portion of the bandwidth.
# Create a new Direct Connect connection
aws directconnect create-connection \
--location "US West (Oregon)" \
--bandwidth 1Gbps \
--connection-name "MyDirectConnectConnection" \
--lag-id lag-12345678
# Create a private virtual interface
aws directconnect create-private-virtual-interface \
--connection-id dxcon-fguhmqlc \
--new-private-virtual-interface \
vlan=100,virtualInterfaceName=MyPrivateVIF,asn=65000,authKey=myBGPAuthKey,amazonAddress=192.168.1.1/30,customerAddress=192.168.1.2/30,addressFamily=ipv4
# Create a public virtual interface for AWS public services
aws directconnect create-public-virtual-interface \
--connection-id dxcon-fguhmqlc \
--new-public-virtual-interface \
vlan=200,virtualInterfaceName=MyPublicVIF,asn=65000,authKey=myBGPAuthKey,amazonAddress=192.168.2.1/30,customerAddress=192.168.2.2/30,routeFilterPrefixes='[{cidr=10.0.0.0/16}]'
# Create a Virtual Private Gateway for Direct Connect (NOT VPN)
aws ec2 create-vpn-gateway \
--type ipsec.1 \
--amazon-side-asn 64512 \
--tag-specifications 'ResourceType=vpn-gateway,Tags=[{Key=Name,Value=DirectConnect-VGW},{Key=Purpose,Value=DirectConnect}]'
# Attach the VGW to your VPC
aws ec2 attach-vpn-gateway \
--vpn-gateway-id vgw-87654321 \
--vpc-id vpc-12345678
# Create a Direct Connect Gateway for multi-region connectivity
aws directconnect create-direct-connect-gateway \
--name MyDirectConnectGateway \
--amazon-side-asn 64512
# Associate a Virtual Private Gateway with Direct Connect Gateway
aws directconnect create-direct-connect-gateway-association \
--direct-connect-gateway-id dxgw-12345678 \
--virtual-gateway-id vgw-87654321 \
--allowed-prefixes cidr=10.0.0.0/16
# Create a Transit Gateway for connecting multiple VPCs
aws ec2 create-transit-gateway \
--description "Transit Gateway for Direct Connect multi-VPC connectivity" \
--options DefaultRouteTableAssociation=enable,DefaultRouteTablePropagation=enable \
--tag-specifications 'ResourceType=transit-gateway,Tags=[{Key=Name,Value=DirectConnect-TGW},{Key=Purpose,Value=MultiVPC-Connectivity}]'
# Attach VPCs to the Transit Gateway
aws ec2 create-transit-gateway-vpc-attachment \
--transit-gateway-id tgw-12345678 \
--vpc-id vpc-12345678 \
--subnet-ids subnet-12345678
# Attach additional VPCs as needed
aws ec2 create-transit-gateway-vpc-attachment \
--transit-gateway-id tgw-12345678 \
--vpc-id vpc-87654321 \
--subnet-ids subnet-87654321
# Associate Direct Connect Gateway with Transit Gateway (only if using Transit Gateway)
aws directconnect create-direct-connect-gateway-association \
--direct-connect-gateway-id dxgw-12345678 \
--transit-gateway-id tgw-12345678 \
--allowed-prefixes cidr=10.0.0.0/8,cidr=172.16.0.0/12
# For VGW-based setup (single VPC):
# Update VPC route table to use Virtual Private Gateway
aws ec2 create-route \
--route-table-id rtb-12345678 \
--destination-cidr-block 192.168.0.0/16 \
--gateway-id vgw-87654321
# Enable automatic route propagation from VGW
aws ec2 enable-vgw-route-propagation \
--route-table-id rtb-12345678 \
--gateway-id vgw-87654321
# For Transit Gateway-based setup (multi-VPC):
# Update VPC route tables to use Transit Gateway
aws ec2 create-route \
--route-table-id rtb-12345678 \
--destination-cidr-block 192.168.0.0/16 \
--transit-gateway-id tgw-12345678
# Verify route tables
aws ec2 describe-route-tables \
--route-table-ids rtb-12345678
# View BGP peer information
aws directconnect describe-virtual-interfaces \
--virtual-interface-id dxvif-fguhmqlc
# Confirm BGP session status
aws directconnect describe-connections \
--connection-id dxcon-fguhmqlc
# Get connection state and metrics
aws directconnect describe-connections-on-interconnect \
--interconnect-id dxcon-fguhmqlc
# List all virtual interfaces
aws directconnect describe-virtual-interfaces
# Check for any connection issues
aws logs describe-log-groups \
--log-group-name-prefix "/aws/directconnect"
# Create a second connection for redundancy
aws directconnect create-connection \
--location "US East (Virginia)" \
--bandwidth 1Gbps \
--connection-name "MyDirectConnectConnection-Backup"
# Create LAG (Link Aggregation Group) for bandwidth aggregation
aws directconnect create-lag \
--number-of-connections 2 \
--location "US West (Oregon)" \
--connections-bandwidth 1Gbps \
--lag-name "MyLAG"
Always configure redundant connections across different Direct Connect locations to ensure high availability.
Use MACsec for layer 2 encryption and implement proper BGP authentication with strong passwords.
Set up CloudWatch alarms for connection state changes and bandwidth utilization thresholds.
Maintain detailed network diagrams and configuration documentation for troubleshooting.
Implementing Direct Connect requires careful planning but delivers significant benefits in terms of performance, security, and cost optimization for enterprise workloads.