Tutorial / Cram Notes

VPC Peering allows you to connect two VPCs within the same or different AWS Regions in a way that makes them able to route traffic between them using private IPv4 or IPv6 addresses. Instances in either VPC can communicate as if they were within the same network.

Use Cases:

  • Connecting two VPCs owned by the same account.
  • Connecting two VPCs in different accounts owned by the same organization.
  • Network connectivity across different geographic regions within a multinational company.

Limitations:

  • VPC Peering connections are not transitive, meaning you cannot route traffic through a peered VPC to reach another VPC.
  • Overlapping IP address ranges are not allowed between peered VPCs.
  • Manual configuration is required to update route tables in each VPC’s subnets.

Example of VPC Peering:

  1. Company A’s VPC with CIDR block 10.0.0.0/16 needs to connect with Company B’s VPC with CIDR block 10.1.0.0/16.
  2. VPC Peering is established, and route tables are updated to include routes to the peered VPC’s subnet.

Transit Gateway

AWS Transit Gateway acts as a network transit hub, allowing you to connect your VPCs and on-premises networks through a central point. It simplifies the network and reduces the number of peering connections required.

Use Cases:

  • Connecting thousands of VPCs and on-premises networks.
  • Simplifying network topology as the number of VPCs grows.
  • Implementing a hub-and-spoke (centralized) network topology.

Advantages:

  • Transit Gateway is transitive, facilitating any-to-any connectivity within its connections.
  • It can be used with AWS Direct Connect or AWS VPN to create a hybrid environment.
  • It integrates with AWS RAM (Resource Access Manager) to share networks across accounts.

Example of Transit Gateway:

  1. Company A has multiple VPCs for development, testing, and production environments.
  2. Instead of peering each VPC, they are all connected to a Transit Gateway which routes traffic between them.

AWS PrivateLink

AWS PrivateLink provides private connectivity between VPCs, AWS services, and on-premises applications, securely on the Amazon network. This avoids exposing data to the public internet.

Use Cases:

  • Accessing AWS services securely from within your VPC.
  • Consuming third-party SaaS applications through AWS.
  • Offering services to AWS Marketplace customers.

Advantages:

  • Reduces the exposure of data to the public internet.
  • Provides secure access to service endpoints inside the VPC environment.
  • Traffic never leaves the Amazon network, offering improved security and performance.

Example of AWS PrivateLink:

  1. A financial services company wants to access the Amazon S3 API from their VPC without routing requests over the public internet.
  2. The company creates an interface VPC endpoint for S3 using AWS PrivateLink, ensuring all traffic to S3 stays inside the AWS network.
Feature VPC Peering Transit Gateway AWS PrivateLink
Connectivity Scope VPC-to-VPC VPC-to-VPC, On-premises, VGW VPC-to-AWS Services, SaaS
Transitivity Non-transitive Transitive Non-transitive
Scaling Manual peering Automatic scaling with TGW Scales with service endpoints
Traffic Flow Within AWS network Centralized routing Always stays on the AWS Network
Cross-account Connectivity Supported with limitations Easily managed with AWS RAM Supported
Region Support Cross-region supported Cross-region supported Generally within single region
Integration with On-premises VPN/Direct Connect required Direct Connect, VPN Integration Requires service endpoints

In summary, the choice of connectivity pattern in AWS depends largely on the specific use case—whether you need straightforward VPC-to-VPC connectivity (VPC Peering), a managed and scalable connectivity hub (Transit Gateway), or secure, private access to services (AWS PrivateLink). Given the AWS Certified Advanced Networking – Specialty (ANS-C01) exam, professionals should understand where and how to apply each connectivity pattern, along with their respective advantages and limitations within the context of a larger network architecture.

Practice Test with Explanation

True or False: VPC Peering connections allow for transitive routing between multiple VPCs.

  • A) True
  • B) False

Answer: B) False

Explanation: VPC Peering connections are non-transitive. This means that if VPC A is connected to VPC B, and VPC B is connected to VPC C, VPC A cannot route traffic to VPC C through VPC B using peering connections.

Which AWS service can be used to enable transitive routing between thousands of VPCs and on-premises environments?

  • A) AWS Transit Gateway
  • B) AWS PrivateLink
  • C) AWS VPN
  • D) AWS Direct Connect

Answer: A) AWS Transit Gateway

Explanation: AWS Transit Gateway enables transitive routing between VPCs and between a VPC and an on-premises network, allowing you to connect thousands of VPCs and on-premises networks.

True or False: AWS PrivateLink provides private connectivity between VPCs, AWS services, and on-premises applications without traversing the public internet.

  • A) True
  • B) False

Answer: A) True

Explanation: AWS PrivateLink allows private connections between VPCs, AWS services, and on-premises applications, ensuring that traffic does not go over the public internet.

Which of the following use cases is best served by AWS Transit Gateway?

  • A) To create a direct physical connection between an on-premises network and AWS
  • B) To filter incoming traffic to a VPC using network access control lists (ACLs)
  • C) To connect multiple VPCs without requiring a VPC peering connection for each pair of VPCs
  • D) To expose a service hosted in a private VPC directly to the public internet

Answer: C) To connect multiple VPCs without requiring a VPC peering connection for each pair of VPCs

Explanation: AWS Transit Gateway is a service that connects multiple VPCs and simplifies the networking topology by eliminating individual peering connections between VPCs.

True or False: AWS Direct Connect can be used in conjunction with AWS Transit Gateway to create a private connection to the AWS cloud.

  • A) True
  • B) False

Answer: A) True

Explanation: AWS Direct Connect can be used alongside AWS Transit Gateway to establish a dedicated, private connection to AWS, augmenting the connectivity and reducing reliance on public internet-based connections.

Which AWS service allows the exposure of a service running in a private subnet of a VPC to consumers in other VPCs without exposing the VPC itself to the internet?

  • A) NAT Gateway
  • B) AWS PrivateLink
  • C) AWS Elastic Load Balancer
  • D) AWS Security Group

Answer: B) AWS PrivateLink

Explanation: AWS PrivateLink facilitates the private exposure of services in a VPC to other VPCs. It enables service consumers to access services privately without requiring the service’s VPC to be directly exposed to the internet.

What is the maximum number of VPC peering connections per VPC allowed by AWS by default?

  • A) 50
  • B) 125
  • C) 250
  • D) 500

Answer: B) 125

Explanation: By default, the limit for VPC peering connections per VPC is However, this limit can be increased upon request.

True or False: With AWS Transit Gateway, you can use the same transit gateway to connect to up to five AWS Direct Connect gateways.

  • A) True
  • B) False

Answer: A) True

Explanation: With AWS Transit Gateway, you can indeed attach up to five AWS Direct Connect gateways, enabling connectivity to multiple on-premises environments.

True or False: Network Address Translation (NAT) gateways can be used to provide internet access to instances in private subnets while still allowing these instances to be reached from the internet.

  • A) True
  • B) False

Answer: B) False

Explanation: NAT gateways allow instances in a private subnet to initiate outbound traffic to the internet but prevent the instances from receiving inbound traffic initiated by someone on the internet.

Which of the following AWS services provides a managed Network Address Translation (NAT) service to enable instances in a private subnet to connect to the internet or other AWS services, but prevent the internet from initiating a connection with those instances?

  • A) AWS Direct Connect
  • B) AWS NAT Gateway
  • C) AWS PrivateLink
  • D) AWS Internet Gateway

Answer: B) AWS NAT Gateway

Explanation: AWS NAT Gateway is used to enable instances in a private subnet to access the internet or other AWS services outbound while preventing unwanted inbound traffic initiated by external sources.

Interview Questions

What is VPC peering and when would you choose to implement it?

VPC peering is a networking connection between two VPCs that enables traffic to route directly between them using private IP addresses. You would choose to implement VPC peering when you need to allow instances in different VPCs to communicate with each other efficiently without using public IPs and without requiring traffic to traverse the internet or a gateway.

What are the limitations of VPC peering that you should be aware of before implementing it?

Some limitations of VPC peering are: it does not support transitive peering relationships (meaning you cannot route traffic through a peering connection to a third VPC), peered VPCs must not have overlapping CIDR blocks, and there are limits on the number of active and pending peering connections you can have.

How does AWS Transit Gateway simplify network architecture?

AWS Transit Gateway simplifies network architecture by acting as a network hub that connects multiple VPCs and, optionally, on-premises networks. It reduces the complexity of network connectivity and management by allowing you to attach multiple VPCs and VPN connections to the Transit Gateway and manage them as one.

Explain how AWS PrivateLink differs from VPC peering and when you would use it?

AWS PrivateLink allows you to securely connect your VPC to supported AWS services, other VPCs, and on-premises applications using private IP addresses. Unlike VPC peering, which connects entire VPCs, PrivateLink focuses on providing access to specific services rather than all the resources of a VPC. Use PrivateLink when exposing your services to consumers in a secure and scalable manner or accessing AWS services without going through the public internet.

Can you peer VPCs that belong to different AWS accounts? If yes, how would you do it?

Yes, you can peer VPCs that belong to different AWS accounts. To do this, you must send a peering request to the owner of the other VPC and have them accept the request. This process can be facilitated through the AWS Management Console or using the AWS CLI.

What are some use cases for AWS Transit Gateway?

Some use cases for AWS Transit Gateway are: simplifying the management of large-scale network architectures, consolidating multiple VPCs and VPN connections, centralizing the management of network routing and policies, and providing a single point of ingress and egress for hybrid cloud setups.

Describe the term ‘Transitive Routing’ within the context of AWS Networking, and is it supported by default in VPC peering?

Transitive routing refers to the ability to route traffic between more than two endpoints in a network through a central hub. AWS supports transitive routing within the context of AWS Transit Gateway but not VPC peering. VPC peering does not support transitive routing natively; you cannot route traffic from VPC A to VPC C through VPC B.

When configuring a VPC peering connection, what is the significance of ‘Route Tables’?

In a VPC peering configuration, route tables are used to control the routing of traffic between the peering VPCs. For each VPC involved in the peering connection, you must update the route table to include a route entry that points to the CIDR block of the peered VPC via the VPC peering connection ID. Without updating route tables, instances in the peered VPCs cannot communicate with each other.

What is the key difference between AWS Transit Gateway and AWS Direct Connect?

AWS Transit Gateway is a service that connects multiple VPCs and on-premises networks through a central hub, simplifying your network and enabling transitive connectivity. AWS Direct Connect, on the other hand, provides a dedicated private connection from an on-premises network to AWS. While Transit Gateway focuses on intra-AWS connectivity, Direct Connect emphasizes a dedicated and consistent connection to AWS services.

In what scenario would AWS PrivateLink be preferred over an Internet Gateway for connecting to AWS services?

AWS PrivateLink would be preferred over an Internet Gateway when you need private connectivity to AWS services without exposing data to the public internet. PrivateLink provides secure, scalable, and direct access to AWS services from your VPC, which can help with compliance requirements and reduce the exposure to internet-based threats.

How do AWS Security Groups and Network Access Control Lists (NACLs) operate in the context of VPC peering?

In the context of VPC peering, Security Groups and Network Access Control Lists (NACLs) operate similarly to how they function within a single VPC. Security Groups continue to act as stateful firewalls at the instance level, while NACLs provide stateless firewall control at the subnet level. Traffic allowed by VPC peering connections still needs to comply with the rules set by the Security Groups and NACLs associated with the resources being communicated with.

Can you initiate a VPC Peering connection between VPCs in different AWS Regions?

Yes, as of November 2017, AWS supports inter-region VPC peering connections. This allows you to peer VPCs across different AWS Regions, enabling cross-region communication between instances using private IP addresses.

0 0 votes
Article Rating
Subscribe
Notify of
guest
25 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Shane Matthews
5 months ago

Great explanation on VPC peering and its use cases!

Nurettin Kemper
5 months ago

Thank you for the detailed blog post! Really helped me understand VPC peering better.

John Walker
6 months ago

Can anyone explain the difference between VPC Peering and Transit Gateway?

درسا حسینی
5 months ago

I’m curious about AWS PrivateLink. Can it replace VPC Peering entirely?

Olivia Johansen
6 months ago

Great post! Really clarified how Transit Gateway simplifies network management.

Rayan Hellum
5 months ago

I think the cost aspect of using Transit Gateway was not fully covered in the blog.

Tvorimir Domashovec
6 months ago

How does the redundancy work with Transit Gateway?

Florian Picard
5 months ago

Thanks for the write-up. Helped me clear a lot of doubts!

25
0
Would love your thoughts, please comment.x
()
x