Dung (Donny) Nguyen

Senior Software Engineer

AWS VPC Gateway Endpoint

AWS VPC Gateway Endpoint is a virtual device that enables private connectivity between your VPC and supported AWS services without requiring an internet gateway, NAT device, VPN connection, or AWS Direct Connect. Gateway endpoints provide a secure, cost-effective way to access AWS services while keeping traffic within the AWS network.

Key characteristics of VPC Gateway Endpoints:

Supported AWS services:

Currently, VPC Gateway Endpoints support only two AWS services:

How VPC Gateway Endpoints work:

  1. Create a gateway endpoint: You create a gateway endpoint in your VPC for either S3 or DynamoDB.
  2. Associate route tables: You specify which route tables should be updated with routes to the gateway endpoint.
  3. Automatic route updates: AWS automatically adds a route to your specified route tables that directs traffic destined for the service to the gateway endpoint.
  4. Traffic routing: When resources in your VPC make requests to the supported service, the traffic is routed through the gateway endpoint and stays within the AWS network.
  5. Policy-based access control: You can attach endpoint policies to control which resources can access the service through the endpoint.

Benefits of using VPC Gateway Endpoints:

Endpoint policies:

Gateway endpoints support endpoint policies, which are IAM resource policies that control access to the service. These policies allow you to:

Example endpoint policy for S3:

{
  "Statement": [
    {
      "Sid": "AllowAccessToSpecificBucket",
      "Effect": "Allow",
      "Principal": "*",
      "Action": [
        "s3:GetObject",
        "s3:PutObject"
      ],
      "Resource": "arn:aws:s3:::my-bucket/*"
    }
  ]
}

Considerations and limitations:

Best practices:

Comparison with VPC Interface Endpoints:

Feature Gateway Endpoint Interface Endpoint
Supported services S3, DynamoDB Most AWS services
Implementation Route table entry ENI with private IP
Cost Free Hourly charge + data processing
DNS Uses public DNS names Uses private DNS names
Security groups Not applicable Supports security groups

Setting up a VPC Gateway Endpoint:

  1. Open the AWS VPC console
  2. Choose “Endpoints” from the navigation pane
  3. Click “Create endpoint”
  4. Select “Gateway” as the endpoint type
  5. Choose the service (S3 or DynamoDB)
  6. Select your VPC
  7. Select the route tables to be associated with the endpoint
  8. Configure the endpoint policy (optional)
  9. Create the endpoint

Once created, the gateway endpoint immediately starts routing traffic for the selected service through the private connection, keeping your data secure within the AWS network.

VPC Gateway Endpoints are an essential tool for building secure, cost-effective AWS architectures, particularly when working with S3 and DynamoDB from resources in private subnets.