Virtual Private Cloud (VPC) Flashcards
What is a VPC?
A virtual private data center in the cloud.
- A logically isolated part of the AWS cloud where you can define your own network
- Complete control of virtual network, including your own IP address range, subnets, route tables and network gateways
- You can leverage multiple layers of security (public subnet, private subnets), including security groups and network access control lists, to help control access to Amazon EC2 instances in each subnet
- You can create a hardware Virtual Private Network (VPN) connection between your corporate data center and your VPC and leverage the AWS cloud as an extension of your corporate data center
http://cidr.xyz
What is the maximum addressable size of IPs you can have with a CIDR block in AWS?
/16 which gives 65,556 network addresses
What can we do with a VPC?
- Launch instances into a subnet of your choosing
- Assign custom IP addresses in each subnet
- Configure route tables between subnets
- Create an Internet Gateway and attach it to a VPC
- Gives much better control over your AWS resources
- Provision access control lists (you can use network access control lists to block specific IP addresses)
What tool in a VPC do you use to block specific IP addresses from gaining access to a VPC?
Network ACL (NACL), not security groups
What are the things you can expect with the default VPC?
- The default VPC is user friendly
- All subnets in the default VPC have a route out to the internet (all public)
- Each EC2 instance has both a public and a private IP address in the default VPC
What are the main components of a VPC?
- Internet gateways (or virtual private gateways)
- Route tables
- Network access control lists (NACLs)
- Subnets
- Security groups
When you create a subnet, where is it created?
In one availability zone, it cannot span multiple availability zones
What are the steps to creating a custom VPC?
- Navigate to VPC service
- Click “Create VPC” button
- Optionally give it a name
- Select IPv4 CIDR block manual input of 10.0.0.0/16 (largest)
- Do not select IPv6 CIDR block
- Select the default tenancy (as opposed to dedicated, which is very expensive)
- Click “Create VPC” button
When you create a VPC, what three things are created by default?
- Main route table
- Main network ACL (NACL)
- Security group
What is a subnet in a VPC?
A virtual firewall
What are the two accessibility options when creating a subnet?
- Public (internet accessible)
- Private (not internet accessible)
What are the steps to creating a new subnet?
- Select a VPC
- Give the subnet a name (e.g. 10.0.1.0/24 - us-east-1a)
- Select the availability zone
- Enter the CIDR block range (10.0.1.0/24) - give 251 available IP addresses with 5 reserved for AWS (10.0.1.0, 10.0.1.1, 10.0.1.2, 10.0.1.3, and 10.0.1.255)
- Click “Create Subnet” button
What are the steps to making a subnet public and internet accessible?
- Select the subnet and click “Edit”
- Check the box labeled “Enable auto-assign public IPv4 address”
- Click “Save”.
- Select the option to create a new Internet Gateway
- Give it a name
- Click “Create”
- Select the newly created Internet Gateway
- Click “Attach to VPC” button
- Select the VPC
- Click “Attach Internet Gateway”
Next, create a new route table with a route in from the internet. If we had used the main route table to create the public route, then any new subnet would be public facing by default.
1. Click “Create Route Table” button
2. Give it a name
3. Select the VPC
4. Click “Create Route Table” button
- Select the new Route Table
- Click “Edit Routes” button
- Click “Add Route”
- Enter the Destination 0.0.0.0/0
- Select the new Internet Gateway as the Target
- Click “Save Changes”
- Select the new Route Table
- Select “Subnet associations” tab
- Click “Edit subnet associations” button
- Select the public subnet
- Click “Save associations” button
What is a NAT Gateway?
You can use a network address translation (NAT) gateway to enable instances in a private subnet to connect to the internet or other AWS services while preventing the internet from initiating a connection to those instances.
How can an instance in a public subnet get access to the internet?
It sends traffic through the Network ACLs, Route Table, Router and Internet Gateway
How can an instance in a private subnet get access to the internet (if the route table prevents it)?
Provision a NAT Gateway in the public subnet that acts as a means for internet traffic to go out through the NAT Gateway, through the public Network ACL, Route Table, Router and Internet Gateway.
What are the key features of a NAT Gateway?
- It is redundant within an AZ for high-availability
- Starts at 5 Gbps and scales to 45 Gbps
- No need to patch
- Not associated with security groups
- Automatically assigned a public IP address
What are the steps to making a NAT Gateway and creating a route out from a private subnet?
- Click “Create NAT Gateway”
- Give it a name
- Select the public subnet
- Click “Allocate Elastic IP” button
- Click “Create NAT Gateway” button
- Select the main route table (that doesn’t have a route out to the internet)
- Click “Edit Routes” button
- Click “Add Route” button
- Enter 0.0.0.0/0 as the Destination
- Select NAT Gateway as the Target
- Click “Save Routes” button
What are Security Groups in VPC?
Virtual firewalls for a VPC
They are the last line of defense of inbound traffic.
If you have a scenario where you have connectivity problems, what things should you look at (and in what order)?
- Look at Route Tables
- Look at Network ACLs
- Check the Security Groups
In Security Groups, by default is all traffic blocked or open?
By default, all traffic is blocked (to let everything in, use 0.0.0.0/0)
Are security groups stateless or stateful?
Security groups are stateful – if you send a request from your instance, the response traffic for that request is allowed to flow in regardless of inbound security group rules, and visa versa.
What is a Network ACL?
An optional layer of security for your VPC that acts as a firewall for controlling traffic in and out of one or more subnets.
They are the first line of defense of inbound traffic.