Amazon VPC
Amazon VPC
Its a service that provides a logically isolated section of AWS Cloud where you can launch
AWS resources in a virtual network that you define. It is your own private network in AWS
where you can place EC2 instances and ELBs
It can have multiple types of gateways for multiple types of resources all in the same VPC,
but different subnets.
VPC Components
Route tables
Implicit router that routes all traffic in the VPC (default router) = all traffic that is for its
CIDR IP address range to be router locally
“Any traffic that goes to destination should be routed through target.”
A target can be:
Specific instance ID
Elastic network interface ID
Internet Gateway
Virtual private gateway
Classless Inter-Domain Routing (CIDR) notation
Primary CIDR block:
non overlapping IP address ranges
Ranges defined in RFC1918 (This standard exists to prevent potential IP collisions
between resources in your private network, and public resources that might be
available on the internet
IPv4 address only between /16 and /28 (16 –65,536 IP addresses) Optional - IPv6
CIDR fixed prefix length of /56, assigned from the pool of IPv6 addresses from AWS
Add up to 4 secondary CIDR blocks
Subnet
Definition
A range of IP addresses, either public or private for grouping resources inside a VPC.
Further segment the VPC address range and to provide logical groupings for resources
(by types, by team, by department)
Exist in one and only one AZ
Subnet CIDR blocks within a VPC must not overlap
Max 200 subnets / VPC
IPv4 min size /28 (16 IP Addresses)
IPv6 fixed size /64, and only one CIDR block/subnet
Using network and security appliances in a VPC: Some network and security
appliances such as load balancers, network address translation (NAT) servers, and
proxy servers prefer to be configured with multiple NICs. You can create and attach
secondary NICs to instances in a VPC that run these types of applications. Then,
configure the additional interfaces with their own public and private IP addresses, and
security groups.
Creating a management only network interface: To ensure that bandwidth on a
customer facing interface is not impacted by management activities (uploading new
versions of software, downloading log files, and so on) a separate ENI is used for
administrative work.
A network access control list (ACL) is a virtual firewall the control #inbound and
#outbound traffic at the subnet level. Aka passport AWS
Certification/CloudPractitioner/Security officer
default: allows all #inbound and #outbound traffic; modifiable with rules
custom: denies all #inbound and #outbound traffic, until rules are added that specify
which traffic to allow
all network ACLs have an explicit deny rule: #packet doesn't match any of the other
rules on the list => denied
#stateless #packet filtering => remember nothing, check #packets that cross the Subnet
each way: #inbound and #outbound .
Security group
Definition
VPC component that check #packet permissions for Amazon EC2 instances. Its a virtual
firewall that controls #inbound and #outbound traffic for #EC2-instances Aka doorman at
your building
default: denies all #inbound traffic and allows all #outbound traffic => the doorman
checks a list at arrival, but not when the #packets leave
#statefull #packet filtering => remember previous decisions made for incoming #packets
Summary
Security group Network ACL
Operates at the instance Operates at the subnet level
level
Applies to an instance only if Applies to all instances deployed in the associated
it is associated with the subnet (providing an additional layer of defense if
instance security group rules are too permissive)
Supports allow rules only Supports allow rules and deny rules
Evaluates all rules before Evaluates rules in order, starting with the lowest
deciding whether to allow numbered rule, when deciding whether to allow traffic
traffic
Stateful: Return traffic is Stateless: Return traffic must be explicitly allowed by the
allowed, regardless of the rules
rules
The following diagram illustrates the layers of security provided by Security group groups
and network ACLs. For example, traffic from an internet gateway is routed to the appropriate
subnet using the routes in the routing table. The rules of the network ACL that is associated
with the subnet control which traffic is allowed to the subnet. The rules of the Security group
that is associated with an instance control which traffic is allowed to the instance.
Only allows connection from an approved network (eg. on-premises data center or internal
corporate network). It allows you to create a virtual private network (VPN) connection.
The VPN encrypts the internet traffic from all the other requests around it. They still use
regular internet connection that has a bandwidth that is being shared by many people using
the internet.
VPC Connectivity options
Network-to-Amazon VPC connectivity options
Definition
You can use a NAT gateway so that instances in a private subnet can connect to services
outside your VPC but external services cannot initiate a connection with those instances.
When you create a NAT gateway, you specify one of the following connectivity types:
Public – (Default) Instances in private subnets can connect to the internet through a
public NAT gateway, but cannot receive unsolicited inbound connections from the
internet. You create a public NAT gateway in a public subnet and must associate an
elastic IP address with the NAT gateway at creation. You route traffic from the NAT
gateway to the internet gateway for the VPC. Alternatively, you can use a public NAT
gateway to connect to other VPCs or your on-premises network. In this case, you route
traffic from the NAT gateway through a transit gateway or a virtual private gateway.
Private – Instances in private subnets can connect to other VPCs or your on-premises
network through a private NAT gateway. You can route traffic from the NAT gateway
through a transit gateway or a virtual private gateway. You cannot associate an elastic
IP address with a private NAT gateway. You can attach an internet gateway to a VPC
with a private NAT gateway, but if you route traffic from the private NAT gateway to the
internet gateway, the internet gateway drops the traffic.
NAT Instance
Definition
Its an EC2 instance with a NAT AMI that is configured to allow resources in a private subnet
to communicate with destinations outside the VPC, such as the internet or an on-premises
network. The resources in the private subnet can initiate outbound IPv4 traffic to the internet,
but they can't receive inbound traffic initiated on the internet.
Resources
Resources
Resources:
Customer gateway
Definition
A customer gateway is a physical device or software application that is defined on the client
side
of a VPN connection. And a AWS resource
Resources
Resources:
AWS Direct Connect + AWS Site-to-Site VPN - Amazon Virtual Private Cloud
Connectivity Options
A VPC endpoint enables customers to privately connect to supported AWS services and
VPC endpoint services powered by AWS PrivateLink. Amazon VPC instances do not require
public IP addresses to communicate with resources of the service. Traffic between an
Amazon VPC and a service does not leave the Amazon network.
VPC endpoints are virtual devices. They are horizontally scaled, redundant, and highly
available Amazon VPC components that allow communication between instances in an
Amazon VPC and services without imposing availability risks or bandwidth constraints on
network traffic. There are two types of VPC endpoints:
AWS PrivateLink
AWS PrivateLink enables customers to access services hosted on AWS in a highly available
and scalable manner, while keeping all the network traffic within the AWS network. Service
users can privately access services powered by PrivateLink from their Amazon Virtual
Private Cloud (VPC) or their on-premises, without using public IPs, and without requiring
traffic to traverse across the Internet. Service owners can register their Network Load
Balancers to PrivateLink services in order to provide their services to other AWS customers.
Resources:
What are VPC endpoints? - Securely Access Services Over AWS PrivateLink
Use-case examples - Securely Access Services Over AWS PrivateLink
AWS PrivateLink FAQs – Amazon Web Services