Difference between revisions of "Create New VPC Environment in AWS"
(Created page with "== Purpose == Amazon Virtual Private Cloud (Amazon VPC) enables us to launch AWS resources into a virtual network that we've defined. <br>This virtual network closely resemb...") |
|||
| Line 8: | Line 8: | ||
This VPC make all instances must use public ip (elastic) to get access to internet and to be able to accessed from internet. | This VPC make all instances must use public ip (elastic) to get access to internet and to be able to accessed from internet. | ||
| − | + | # Create VPC with CIDR (ex : 172.31.0.0/16) | |
| − | + | # Create subnet (ex : 172.31.156.0/24) | |
| − | + | # Create internet gateway (attach to the VPC) | |
| − | + | # Edit route tables (which already attached to the VPC automatically) | |
| − | + | #: Route | |
| − | + | #:: destination : 172.31.0.0/16 ; target : local | |
| + | #:: destination : 0.0.0.0/0 ; target : internet gateway | ||
Note : In this VPC, we don't need to create new route tables. Just need to edit. | Note : In this VPC, we don't need to create new route tables. Just need to edit. | ||
| − | |||
== Create AWS VPC with Public & Private Subnet == | == Create AWS VPC with Public & Private Subnet == | ||
Revision as of 12:02, 5 November 2019
Purpose
Amazon Virtual Private Cloud (Amazon VPC) enables us to launch AWS resources into a virtual network that we've defined.
This virtual network closely resembles a traditional network that we'd operate in our own data center, with the benefits of using the scalable infrastructure of AWS.
Create AWS VPC with Public Subnet Only
This VPC make all instances must use public ip (elastic) to get access to internet and to be able to accessed from internet.
- Create VPC with CIDR (ex : 172.31.0.0/16)
- Create subnet (ex : 172.31.156.0/24)
- Create internet gateway (attach to the VPC)
- Edit route tables (which already attached to the VPC automatically)
- Route
- destination : 172.31.0.0/16 ; target : local
- destination : 0.0.0.0/0 ; target : internet gateway
- Route
Note : In this VPC, we don't need to create new route tables. Just need to edit.
Create AWS VPC with Public & Private Subnet
This VPC must be created with two subnets. One as public subnet, where all instances in this subnet must use public ip (elastic ip) to get access to internet and to be able to accessed from internet. The second one as private subnet, where all instance only use private ip. They can access internet through a NAT gateway. But they can not be accessed directy from internet.
1. create vpc with cidr (ex : 172.31.0.0/16)
2. create subnet 1 (ex : 172.31.156.0/24) 3. create subnet 2 (ex : 172.31.157.0/24)
4. create internet gateway (attach to the vpc) 5. create nat gateway (with public ip, attach to the vpc)
6. create route tables 1 (attach to the vpc)
route >> destination : 172.31.0.0/16 ; target : local
destination : 0.0.0.0/0 ; target : internet gateway
subnet association >> 172.31.156.0/24
7. create route tables 2 (attach to the vpc)
route >> destination : 172.31.0.0/16 ; target : local
destination : 0.0.0.0/0 ; target : nat gateway
subnet association >> 172.31.157.0/24
Note : In this VPC, just keep the existing route table and then we need to create new two route tables.