Lesson 4 of 4 Networking and Content Delivery

Connecting VPCs and Reaching AWS Services Privately

This lesson explains how companies with many VPCs connect them to each other and to AWS services, ideally without sending traffic over the public internet.

Learning outcomes

After completing this lesson, you will be able to:

  • Choose between VPC peering and AWS Transit Gateway from the number of VPCs.
  • Distinguish gateway endpoints from interface endpoints.
  • Identify the services that connect on-premises networks to AWS.

Connecting VPCs

The right way to connect VPCs depends on how many there are. VPC peering connects two VPCs directly, with traffic staying on the AWS network, which suits a few VPCs that need to talk to each other. AWS Transit Gateway is a central hub that many VPCs and on-premises networks attach to, so each network needs only one connection, which simplifies routing as the number grows. The following table summarises the options.

OptionHow it worksBest for
VPC peeringA direct connection between two VPCs; traffic stays on the AWS networkA few VPCs that need to talk to each other
AWS Transit GatewayA central hub that VPCs and on-premises networks attach toMany VPCs and networks; simplifies routing

Peering is not transitive: if A peers with B and B with C, A cannot reach C through B. Transit Gateway solves this by acting as a hub.

Troubleshooting scenario

VPC A cannot reach VPC C

Exam skills 3.5.1

Resolve a VPC connectivity problem.

Log in to try this activity Interactive activities are free with an account.

Reaching AWS services privately

By default, an instance in a private subnet needs a NAT gateway to reach public AWS service endpoints such as S3. VPC endpoints let it reach them privately. There are two types, as follows.

  • Gateway endpoints for Amazon S3 and DynamoDB, free of charge.
  • Interface endpoints (powered by AWS PrivateLink) for most other services, and for services offered by other companies or your own teams.
Sort into groups

Gateway or interface endpoint?

Exam skills 3.5.1

Decide which type of VPC endpoint each service uses.

Log in to try this activity Interactive activities are free with an account.

Reaching on-premises networks

AWS provides several services for connecting on-premises networks and users to AWS. The following list describes them.

  • AWS Site-to-Site VPN: encrypted tunnels over the internet; quick to set up.
  • AWS Direct Connect: a dedicated private connection with consistent performance; takes longer to set up.
  • AWS Client VPN: lets individual users connect to a VPC from their devices.
Worked example

A company has 40 VPCs across several accounts and an office network, all of which must be able to communicate. Managing dozens of peering connections has become difficult. Which service simplifies this?

AWS Transit Gateway: each VPC and the office VPN attach to one hub, instead of a mesh of peering connections.

Check yourself

Which service connects many VPCs and on-premises networks through one central hub?

Show answer

AWS Transit Gateway.

Exam Tips

Remember for the exam

  • VPC peering connects two VPCs and is not transitive.
  • Transit Gateway is a hub that connects many VPCs and on-premises networks.
  • Gateway endpoints (S3, DynamoDB) are free; interface endpoints use PrivateLink.
  • PrivateLink keeps traffic to services off the public internet.
  • Site-to-Site VPN goes over the internet; Direct Connect is a private dedicated link.