Skip to main content

AWS VPC Endpoints: Gateway vs Interface Explained

Updated 5 min readMarkdown
Part of seriesFinOps: Cloud Cost Optimization & Financial Operations
AWS VPC Endpoints: Gateway vs Interface Explained

Introduction

How can an EC2 instance in a private subnet access AWS services without an Internet Gateway or NAT Gateway?

The answer is AWS VPC Endpoints.

VPC Endpoints enable private connectivity to supported AWS services, improve cloud security, and potentially reduce networking costs.

In this article, we will explore Gateway Endpoints, Interface Endpoints, their differences, and practical implementation using AWS CLI.

What is an AWS VPC Endpoint?

An AWS VPC Endpoint enables resources within a VPC to communicate with supported services without requiring public IP addresses or internet connectivity for that communication.

Key benefits:

  • Private and secure connectivity
  • Reduced NAT Gateway dependency
  • Potential cost optimization
  • Granular access control
  • Improved network security

1. Gateway VPC Endpoint

Gateway Endpoints support two AWS services:

  • Amazon S3
  • Amazon DynamoDB

They work by adding service-specific routes to the VPC route table.

Architecture

EC2 (Private Subnet)
        |
    Route Table
        |
  Gateway Endpoint
        |
     Amazon S3

Key Features

  • No additional endpoint charges
  • Route table-based connectivity
  • No dedicated network interface
  • Supports endpoint policies

Create an S3 Gateway Endpoint

aws ec2 create-vpc-endpoint \
  --vpc-id vpc-xxxxxxxx \
  --service-name com.amazonaws.ap-south-1.s3 \
  --vpc-endpoint-type Gateway \
  --route-table-ids rtb-xxxxxxxx \
  --region ap-south-1

Test connectivity from a private EC2 instance:

aws s3 ls s3://your-bucket-name

2. Interface VPC Endpoint

Interface Endpoints use AWS PrivateLink to provide private connectivity to supported AWS services.

AWS creates an Elastic Network Interface (ENI) with a private IP address in each selected subnet.

Supported Services

  • AWS Secrets Manager
  • Amazon CloudWatch Logs
  • Amazon ECR
  • AWS Systems Manager
  • AWS KMS
  • Amazon SQS and SNS

Architecture

EC2 (Private Subnet)
        |
  Interface Endpoint (ENI)
        |
    AWS PrivateLink
        |
  AWS Secrets Manager

Key Features

  • Private IP-based connectivity
  • Security group support
  • Private DNS support
  • Hourly and data processing charges
  • Supports numerous AWS services

Create an Interface Endpoint

aws ec2 create-vpc-endpoint \
  --vpc-id vpc-xxxxxxxx \
  --service-name com.amazonaws.ap-south-1.secretsmanager \
  --vpc-endpoint-type Interface \
  --subnet-ids subnet-xxxxxxxx \
  --security-group-ids sg-xxxxxxxx \
  --private-dns-enabled \
  --region ap-south-1

Ensure the endpoint security group allows inbound HTTPS traffic on port 443 from authorized workloads.

Test DNS resolution:

nslookup secretsmanager.ap-south-1.amazonaws.com

With private DNS configured correctly, the hostname resolves to private endpoint IP addresses.

Gateway vs Interface Endpoints

Feature Gateway Interface
Services S3, DynamoDB Multiple AWS services
Technology Route Table AWS PrivateLink
Dedicated Private IP No Yes
Endpoint Security Group No Yes
Endpoint Charges None Paid
Network Interface No Yes
On-Premises Access Not directly Supported with private connectivity

Real-World DevOps Use Cases

S3 Backups

Use Gateway Endpoints to transfer application backups to S3 without unnecessary NAT Gateway processing charges.

Secure Credential Management

Use Interface Endpoints to retrieve application credentials privately from AWS Secrets Manager.

Private Container Deployments

Use ECR Interface Endpoints and an S3 Gateway Endpoint to pull supported container images without internet access.

Production Monitoring

Use CloudWatch Logs Interface Endpoints to send application logs from isolated private subnets.

Cost Optimization

Gateway Endpoints have no additional endpoint charges, making them an excellent choice for regional S3 and DynamoDB workloads.

Interface Endpoints incur hourly and data processing charges.

Before implementation, compare:

  • NAT Gateway processing charges
  • Interface Endpoint hourly charges
  • Data processing charges
  • Availability Zone requirements

The cheapest solution depends on your architecture and traffic volume.

Security Best Practices

  • Follow the principle of least privilege.
  • Restrict endpoint policies where supported.
  • Allow HTTPS only from authorized workloads.
  • Enable private DNS where appropriate.
  • Deploy critical Interface Endpoints across multiple Availability Zones.
  • Monitor API activity using AWS CloudTrail.
  • Remove unused endpoints to avoid unnecessary costs.

Common Mistakes

  • Associating incorrect route tables with Gateway Endpoints.
  • Blocking port 443 in Interface Endpoint security groups.
  • Disabling required VPC DNS settings.
  • Using overly permissive endpoint policies.
  • Assuming VPC Endpoints replace general internet access.
  • Ignoring Interface Endpoint charges.

Frequently Asked Questions

Are AWS VPC Endpoints free?

Gateway Endpoints have no additional endpoint charges. Interface Endpoints have hourly and data processing charges.

Can VPC Endpoints replace NAT Gateways?

Yes, when all required outbound connections can be handled through supported endpoints or other private connectivity.

No. Gateway Endpoints use VPC routing, while Interface Endpoints use AWS PrivateLink.

Conclusion

AWS VPC Endpoints help DevOps engineers design secure, private, and cost-effective cloud infrastructure.

Remember:

  • S3 and DynamoDB: Prefer Gateway Endpoints for eligible in-VPC traffic.
  • Secrets Manager, CloudWatch Logs, ECR and other supported services: Use Interface Endpoints.
  • General internet access: Use a NAT Gateway or another appropriate connectivity solution.

Choosing the right endpoint helps balance security, cost, performance, and operational requirements.

Official AWS Documentation


If you found this article helpful, follow my blog for more practical AWS, Kubernetes, Linux, Terraform, and DevOps tutorials.

Happy Cloud Engineering!

About the author

  • DevOps Engineer with hands-on experience in AWS, Linux, Docker, Kubernetes, Terraform, and CI/CD pipelines. Passionate about building scalable, secure, and automated cloud infrastructure. I write about DevOps, Cloud Computing, AWS, Infrastructure as Code, Kubernetes, and Site Reliability Engineering (SRE).

No comments yet. Be the first to comment.

FinOps: Cloud Cost Optimization & Financial Operations

Part 3 of 3

Learn FinOps from the ground up. This series covers cloud cost optimization, budgeting, forecasting, AWS cost management, tagging strategies, cost allocation, monitoring, governance, and real-world FinOps best practices to help organizations maximize cloud value while controlling spending.

Start from the beginningAWS Cost Optimisation in 2026: Ultimate Guide to Cut Your Bill by 30-70% Without Sacrificing PerformancePractical, step-by-step AWS cost optimisation strategies every DevOps and MLOps engineer should implement in 2026. Learn the key metrics to track, tools to use, and real-world tactics for maximum savings.

More from this blog