AWS-VPC-1
OSI (Open System Interconnection) Model
There are 7 Layers:
- Application Layer - http request and so on
- Presentation Layer
- Session Layer
- Transport Layer - wrap data to be a segment/datagram, there is one example in the load balancer
- Network Layer - wrap data to be a package to transfer
- Data Link Layer - wrap data to be a frame to transfer
- Physical Layer - communication by using bit unit
TCP/IP (default protocol in this course, the most famous protocol suite)
- Using TCP (Transmission Control Protocol) in the Transport Layer. In this layer, UDP also is a famous protocol we are using.
- Using IP (Internet Protocol) in the Network Layer., in this layer, ICMP also is a famous protocol we are using, which is like we are typing `ping` in cmd.
IP Address
- `ipconfig`, check your IP information, like IP address.
- LAN/WAN (local area network, wide area network), the private IP address is existing in LAN, and the public IP address is existing in WAN.
- Only the public IP address is able to communicate with and be accessed by public internet.
- *Each IP address is a potential security risk.
House LAN IP Diagram

IPv6 and IPv4
- IPv6: 8, segments, and each segment consist of 4 hex digits.
- for example:
- 2001:0db8:85a3:0000:0000:8a2e:0370:7334
- 2001: db8:85a3: 0: 0:8a2e: 370:7334 // the 0s at the front could be removed, each segment should at least has one hex digit
- 2001: db8:85a3 :: 8a2e: 370:7334 // continue 0s could be replaced by ::
- IPv6 could be disabled in AWS configuration, but IPv4 cannot
- IPv4: skip
Region and Availability Zone
- Region is an independent existence (geographical span), there are so many regions existed in AWS.
- Each region has at least two availability zones.
- AZs are connected by the low latency network, also could be understood as geographical span, but smaller.
- Regions are connected by reserved bandwidth provided by internet service providers.
VPC (Virtual Private Cloud) and Subnet
VPC
- VPC is your own virtual data center, each VPC is independent of outside.
- Each vpc has to be assigned to a Region, and it could across multiple availability zones, but it cannot across multiple regions.
- When creating a new VPC, we need to assign a CIDR to it, and it should be between 28 ~ 16.
Subnet
- Logically, separating different small chunk of areas from VPC, each of them we called subnet.
- Each of subnets from VPC has to be assigned to an availability zone. (Thinking: each VPC has to be assigned to a Region, in this region, there are many availability zones. The subnet is one part of separate chunks, each part should work properly so that it should be assigned to an integral infrastructure, that is availability zone.)
- When creating a new subnet from VPC, we need to assign a CIDR to it, and it should be distinguished with others, each CIDR for subnet also should between 28 ~ 16.
CIDR (Classless Inter-Domain Routing)
- IPv4, 4 segments/32 bits (be consist of 4 segments, each segment is consist of 8 bits so that total there are 32 bits).
- CIDR block, counting from the left side, blocking the number of bits (unavailable to use).
- Overlap, left close, right open. (172.12.16.0/20, and 172.12.32.0/20, they are not overlapped, because of the range of {1} is [16, 32), and the range of {2} is [32, 48). )
Rout Table and Routing
- In each VPC, there is an implicit Router existed which user can use it by configuring the Routing Table.
- Each time the user creates a new VPC, the system will automatically generate the main routing table. This main routing table will be the default route table assigned to this VPC's new subnet.
- Each main route table for VPC cannot be removed directly, because each VPC has to have the main route table. If need, user should create a new routing table and set it as the new main routing table for the VPC, and then it is legal to remove the old main routing table (at this time, the old routing table will be normal routing table, because the "main" already be assigned to the other routing table).
- Each subnet will be assigned only one route table, but each route table could be assigned to multiple subnets.
- The VPC CIDR will default exist in all routing tables (In each route table, based on CIDR there is one routing path named "local" related to the VPC CIDR. If there are multiple CIDRs, then for each VPC CIDR, there is one "local" be configured for.).
- IPv4 and IPv6 routing paths are separated, independently.
- Priority is based on CIDR, the CIDR range more specific, the higher priority.
Internet Gateway and NAT Gateway
Internet Gateway
Existed in VPC, for communicating with the public internet, it is two-way bindings (inbound and outbound).NAT (Network Address Translation) Gateway
In the NAT device, there is a public IP address. For the hosts placed in the private subnet if they want to connect public internet, they need to access to NAT gateway, then connect to the internet gateway for outside access (Private IP address translate to Public IP address). It is single-binding (outbound), because, there is no way to access to internal service, only can send the request to outside.
For the usage of personal or small-scale company, it is better to use NAT instance (actually it is an EC2 virtual machine which purpose is for internet address translation) instead of using NAT gateway for avoiding high-cost. (If do this, please uncheck the "source destination check")
Public Subnet and Private Subnet
- In the public subnet, all of the hosts have their own public IP address and private IP address.
- In the private subnet, all of the hosts only have their own private IP address, but they don't have their public IP address.
Elastic IP Address
- Elastic IP address is a static public IPv4 address which is bounded to user's AWS account.
- User can associate an elastic IP address to an EC2 instance or ENI (Elastic Network Interface).
- Generally, assign the elastic IP address to a stable instance, like NAT instance, load balancer, tec.
- User can use their own IP pool, BYOIP; or use AWS IP pool, Amazon pool to assign the elastic IP address. (Different to BYOIP, the elastic IP address comes from AWS IP pool is not for free, but if the user satisfied with three scenarios, a. the elastic IP associated to an EC2 instance, b. the EC2 instance is running, c. there is only one elastic IP address associated with the EC2 instance, the use of IP addresses).
Connect to your VPC
VPN (Virtual Private Network)
- In each VPN connection, between the data center and VPC, there are two tunnels which applied encrypt protocol.
- At the AWS VPC endpoint, the tunnel connected to VPG (Virtual Private Gateway), and at the Customer endpoint, the tunnel connected to CG (Customer Gateway).
- Set up fast, and cheep.
DX (Direct Connect)
- Reserve customer's own connection channel from the internet service partner.
- At the AWS VPC endpoint, the connection connected to VPG (Virtual Private Gateway), but for the customer endpoint, because of the customer is connecting the AWS DX partner, the AWS DX partner will provide a customer router to directly connect to customer router. Between AWS DX location and AWS VPC endpoint, the connection connected to Direct Connect Endpoint from AWS DX location through Private Virtual Interface. Not only able to connect VPG but the DCG also able to connect to AWS services and resources through Public Virtual Interface. Through the private virtual interface, AWS DX endpoint also connects DCG (Direct Connect Gateway) which is able to connect multiple VPCs
- Set up slow and expensive, but speed fast and stable.
Redundancy
- Active VPN + Active VPN
VPC only need one VPN, but if internet failure, then both of VPNs won't work because of both of customer endpoints connected to the same virtual private gateway. - Active DX + Active DX
The company uses different devices to setup two DX, but both of them connected to the same virtual private gateway. - Active DX + Axtive VPN
The company set up DX to make sure that all of the data transmission goes through DX with high priority, but if DX got a failure, then switch to VPN to keep connection available.




Comments
Post a Comment