PracticeVideosBlogFlashcards

12.2 Private Network Connectivity: VPC Endpoints & Peering

Key Takeaways

  • Gateway VPC Endpoints provide free, route table-based private connectivity exclusively for Amazon S3 and DynamoDB, but are strictly non-transitive and cannot be accessed from on-premises or peered VPCs.

  • VPC Endpoint Policies attached to endpoints restrict accessible resources (such as specific S3 bucket ARNs) to prevent corporate data exfiltration.

  • Interface VPC Endpoints (AWS PrivateLink) provision Elastic Network Interfaces (ENIs) with private IP addresses in subnets, supporting over 100 AWS services and transitive hybrid routing.

  • Private DNS for Interface Endpoints automatically overrides public service domain names to resolve to private ENI IP addresses, requiring enableDnsHostnames and enableDnsSupport on the VPC.

  • VPC Peering enables 1:1 non-transitive connections without overlapping CIDRs, supporting up to 9001-byte jumbo frames intra-Region but capping MTU at 1500 bytes cross-Region.

Last updated: September 2026

12.2 Private Network Connectivity: VPC Endpoints & Peering

CloudOps Blueprint Focus: The AWS Certified CloudOps Engineer – Associate (SOA-C03) exam tests your ability to establish private network connectivity without traversing the public internet. You must master the architectural differences between Gateway Endpoints and Interface Endpoints (AWS PrivateLink), configure endpoint policies to prevent data exfiltration, ensure private DNS resolution, and navigate VPC Peering constraints including non-transitive routing and MTU limits.

Private Connectivity: Gateway Endpoints vs. Interface Endpoints

AWS provides VPC Endpoints to connect VPC resources to supported AWS services and partner applications without an Internet Gateway, NAT Gateway, or public IP addresses. VPC Endpoints fall into two distinct architectures: Gateway Endpoints and Interface Endpoints (AWS PrivateLink).

Architectural DimensionGateway EndpointsInterface Endpoints (AWS PrivateLink)
Supported ServicesAmazon S3 and Amazon DynamoDB only.100+ AWS services, custom internal services, and SaaS.
ImplementationRoute table entry targeting an AWS Prefix List (pl-xxxx).Elastic Network Interface (ENI) with private IP via NLB.
Cost ModelFree ($0.00). No hourly or data processing charges.Paid. ~$0.01/hour per AZ ENI + $0.01 per GB processed.
Extended ReachVPC-local only. Inaccessible from VPN, DX, or Peering.Transitive reach. Accessible over DX, VPN, Peering, and TGW.
DNS ConfigurationStandard DNS; routed via prefix lists.Private DNS overrides public service domain names.
Security ControlsVPC Endpoint Policy.Security Groups attached to ENIs + VPC Endpoint Policy.

Gateway Endpoints: Route Table Targets & Endpoint Policies

A Gateway Endpoint is a managed routing target for VPC route tables connecting to Amazon S3 or Amazon DynamoDB.

Routing Mechanics & Prefix Lists

Creating a Gateway Endpoint generates an entry in selected route tables pointing to an AWS Prefix List representing regional service IP ranges:

Destination: pl-63a5400a (com.amazonaws.us-east-1.s3)⟶Target: vpce-xxxx\text{Destination: } \texttt{pl-63a5400a (com.amazonaws.us-east-1.s3)} \longrightarrow \text{Target: } \texttt{vpce-xxxx}

Because the prefix list is more specific than the default route (0.0.0.0/0), traffic to S3 or DynamoDB routes across the AWS private network, bypassing NAT Gateways and eliminating data processing fees.

Non-Transitive Boundary Limitation

Gateway Endpoints cannot be accessed from outside the VPC:

  • On-premises hosts connected via AWS Direct Connect or Site-to-Site VPN cannot route through a VPC to reach a Gateway Endpoint.
  • Peered VPCs and Transit Gateways cannot route traffic to a Gateway Endpoint in another VPC.
  • Gateway Endpoints only serve resources within subnets associated with the designated VPC route tables.

Endpoint Policies for Data Exfiltration Prevention

By default, Gateway Endpoints permit access to any S3 bucket across any AWS account. To prevent unauthorized exfiltration to external accounts, attach a VPC Endpoint Policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowCorporateBucketsOnly",
      "Effect": "Allow",
      "Principal": "*",
      "Action": ["s3:GetObject", "s3:PutObject", "s3:ListBucket"],
      "Resource": [
        "arn:aws:s3:::corp-production-storage",
        "arn:aws:s3:::corp-production-storage/*"
      ]
    }
  ]
}

Requests to unauthorized buckets through this endpoint are rejected with an HTTP 403 Forbidden error.


Interface Endpoints (AWS PrivateLink) & Private DNS

Interface Endpoints use AWS PrivateLink to provide private access to over 100 AWS services (e.g., EC2, SSM, Secrets Manager, KMS, and S3 Interface endpoints), third-party SaaS platforms, and internal microservices.

Elastic Network Interfaces (ENIs) & Hybrid Reach

Provisioning an Interface Endpoint places an Elastic Network Interface (ENI) with a private IP address into each designated subnet. Traffic flows through the ENI to an AWS-managed Network Load Balancer (NLB) fronting the service fleet:

  • Security Groups: Standard security groups attach to the endpoint ENIs to restrict inbound traffic to authorized source CIDRs and ports (typically TCP 443).
  • Hybrid Accessibility: Because Interface Endpoints have private IP addresses, they are fully routable from on-premises over AWS Direct Connect or Site-to-Site VPN, across VPC Peering connections, and through AWS Transit Gateway.

Private DNS Resolution Mechanics

Interface Endpoints generate specific regional DNS hostnames (e.g., vpce-xxxx.s3.us-east-1.vpce.amazonaws.com). Enabling Private DNS creates a private Route 53 zone overriding the public service endpoint (e.g., secretsmanager.us-east-1.amazonaws.com), resolving it directly to the endpoint ENI private IPs:

  • Applications and SDKs continue using standard endpoint URLs without code modifications.
  • Prerequisites: Both enableDnsHostnames and enableDnsSupport must be set to true on the VPC for Private DNS to function.

VPC Peering: Architecture, Constraints & MTU Tuning

VPC Peering creates a 1:1 network connection between two VPCs within the same Region or across Regions and accounts. All traffic travels over the private AWS backbone with physical-layer encryption.

Core Peering Constraints

  • No Overlapping CIDRs: VPCs with matching or overlapping CIDR blocks cannot be peered.
  • Bidirectional Route Tables: Routes must be added manually in both VPC route tables directing the peer CIDR to the peering connection ID (pcx-xxxx).
  • Security Group Referencing: Intra-Region peering allows referencing peer security groups by ID. Cross-Region peering does not support peer security group references; rules must use CIDR blocks.

The Non-Transitive Routing Constraint

VPC Peering does not support transitive routing:

VPC A⟷VPC B⟷VPC C⇏VPC A⟷VPC C\text{VPC A} \longleftrightarrow \text{VPC B} \longleftrightarrow \text{VPC C} \quad \nRightarrow \quad \text{VPC A} \longleftrightarrow \text{VPC C}

Traffic cannot hop through an intermediate VPC. Connecting multiple VPCs requires either:

  1. Full Mesh Peering: Direct peering links between every VPC pair (N(N−1)2\frac{N(N-1)}{2} links; 10 VPCs require 45 links).
  2. AWS Transit Gateway: A central regional hub-and-spoke router supporting transitive routing across thousands of VPCs and on-premises connections.

MTU Configurations

  • Intra-Region Peering: Supports Jumbo Frames up to 9001 bytes, optimizing throughput for high-volume transfers.
  • Cross-Region Peering: Strictly capped at 1500 bytes. Packets exceeding 1500 bytes are fragmented or dropped.
Test Your Knowledge

A financial institution connects its on-premises data center to an Amazon VPC using an AWS Direct Connect dedicated connection terminating on a Virtual Private Gateway (VGW). The on-premises analytics platform requires daily batch access to an Amazon S3 bucket containing historical transaction logs without sending traffic across the public internet. The VPC already contains an S3 Gateway VPC Endpoint used by in-VPC EC2 instances. When the network administrator attempts to route on-premises traffic to the S3 Gateway Endpoint, the connection fails. What is the root cause of this failure, and what is the AWS-recommended solution?

A

The Direct Connect connection requires a public virtual interface (public VIF) with BGP community tagging to route on-premises traffic through a Gateway Endpoint.

B

Gateway VPC Endpoints are non-transitive and cannot be accessed from on-premises networks over Direct Connect or VPN; the team must deploy an Interface VPC Endpoint (AWS PrivateLink) for Amazon S3 in the VPC and route on-premises queries to its private IP addresses.

C

The S3 bucket policy must be updated to include the on-premises public ASN in the aws:SourceIp condition block.

D

Gateway Endpoints require bidirectional NAT; the team must deploy an EC2 NAT instance configured with iptables to proxy on-premises S3 traffic.

Test Your Knowledge

A company operates three Amazon VPCs in the same AWS Region: VPC A (10.1.0.0/16) hosts frontend web services, VPC B (10.2.0.0/16) hosts shared security and auditing tooling, and VPC C (10.3.0.0/16) hosts backend database clusters. VPC A is peered with VPC B via connection pcx-ab, and VPC B is peered with VPC C via connection pcx-bc. The engineering team attempts to route traffic from VPC A to the database clusters in VPC C by adding a route in VPC A's route table for 10.3.0.0/16 pointing to pcx-ab, and a route in VPC B pointing 10.3.0.0/16 to pcx-bc. However, network packets from VPC A to VPC C are silently dropped. Why does this routing configuration fail, and how should it be resolved?

A

VPC peering requires jumbo frame negotiation; the team must adjust the MTU size on EC2 network adapters in VPC B from 9001 to 1500 bytes.

B

The security group in VPC C must add an inbound rule referencing the security group ID of the EC2 instances in VPC A.

C

VPC peering does not support transitive routing; traffic cannot hop through VPC B to reach VPC C. The team must either establish a direct VPC peering connection between VPC A and VPC C with updated route tables, or deploy an AWS Transit Gateway to interconnect all three VPCs.

D

Route propagation was not enabled on the default Internet Gateway in VPC B; enabling route propagation automatically resolves multi-hop peering routes.

Test Your Knowledge

An operations team deploys an Interface VPC Endpoint for AWS Secrets Manager in a private VPC to allow EC2 instances to retrieve credentials securely. When testing API calls using the AWS CLI command aws secretsmanager get-secret-value, the CLI requests time out. Network analysis reveals that the AWS CLI is still attempting to connect to public IP addresses associated with secretsmanager.us-east-1.amazonaws.com rather than the private IP addresses of the endpoint ENIs. Which configuration setting is missing on the VPC or endpoint?

A

Both enableDnsHostnames and enableDnsSupport must be enabled on the VPC, and the Interface Endpoint must have Private DNS enabled so that the service domain name automatically resolves to the endpoint ENI private IP addresses.

B

The VPC must be attached to an Internet Gateway with a route for 0.0.0.0/0 to allow the Route 53 Resolver to forward public DNS queries.

C

The CloudOps engineer must configure an Amazon Route 53 public hosted zone with CNAME records mapping the service domain name to an S3 Gateway Endpoint.

D

A customer-managed BIND DNS server must be installed on an EC2 instance in the public subnet to rewrite DNS requests using response policy zones (RPZ).

Sections you finish are checked off in the contents.