官术网_书友最值得收藏!

Creating a VPC

In this section, we will look at an overview of the VPCs, subnets, route tables, internet gateways, and other networking components that are created in all regions. Unlike most AWS services, the overview in the VPC dashboard is global, which allows us to get a really good understanding of our network and the number of VPCs and other network components in our entire AWS environment. Let's follow these steps to get started:

  1. To create and configure a VPC, we need to navigate to the VPC Dashboard, as shown in the following screenshot: 
  1. We will be creating a VPC and all its component by navigating to the appropriate sections of the VPC Dashboard. First, we will create a VPC from the Your VPCs section by clicking on Create VPC:
  1. We will name our VPC and assign a network CIDR. We also have the option of selecting whether we would like to have an IPv6 CIDR added to the VPC, and whether the VPC needs to have dedicated tenancy. For our purposes, we will create a network CIDR of 10.0.0.0/16 and leave advanced options at their defaults before clicking Yes, Create:

Now that we have created the new VPC, we will need to create the subnets for the VPC.

  1. To create a subnet, we will navigate to the Subnets section of the VPC Dashboard and click on Create subnet.
  2. Once in the Create Subnet dialogue, we have the option to give the subnet a name and select the VPC in which we will be creating it. Please choose your newly created VPC.
  3. Next, we will select the availability zone and create a new CIDR block for the subnet. We should be creating multiple subnets if we would like to have the services in the subnets highly available and separated into public and private subnets. A minimum of four subnets is recommended: two public and two private, with each pair spread across two availability zones.
  1. Next we will create an Internet Gateway to support internet connectivity and make the subnet public. We need to navigate to the Internet Gateways section of the VPC Dashboard and click the Create internet gateway button. Once in the Create internet gateway dialogue, we simply need to name our IGW and click Create:

Once created, the IGW is detached.

  1. Now, we need to select the newly created IGW and attach it to our newly created VPC by clicking on Actions and selecting Attach to VPC:
  1. In the Attach to VPC dialogue, we select our VPC and click on Attach:

Now that we have attached the IGW to the VPC, we need to create a new route table so that our public subnets can have access to the internet.

  1. Navigate to the Route Tables section of the VPC Dashboard and select the route table that was created for your VPC. This route table is also called the main route table. It is predefined to allow all subnets within the 10.0.0.0/16 network to communicate with each other. All of the subnets that are created are associated with this route table by default.
  1. Now, let's create a new route table by clicking on the Create Route Table button:
  1. In the Create Route Table section, we need to give it a name and select our VPC, and then click Yes, Create:

Now that the route has been created, we need to allow access to the internet via this route.

  1. Select the newly created route, click on the Routes tab, click Edit, and then click Add another route. We need to select our IGW as the target and 0.0.0.0/0 for the destination – this denotes all routes and is the default CIDR for the internet. Click on the Save button to put the new setting into effect:
  1. To make any of the subnets we created public, we simply need to associate them with this newly created route table. Select the Subnet Associations tab and click Edit. Select the subnets you want to make public and click Save:
  1. To allow the instances being deployed in the public subnets to be automatically available from the internet, we can configure the public IP assignment so that it's performed automatically. This is an optional step. To configure automatic IP assignment, navigate to the Subnets section of the VPC Dashboard, select any of your public subnets, click on Actions, and click on Modify auto-assign IP settings:
  1. Select the check mark next to Auto-assign IPv4 and click on Save. Make sure that you repeat this step for the second public subnet:
主站蜘蛛池模板: 马龙县| 本溪市| 承德市| 托里县| 文登市| 扎鲁特旗| 高陵县| 新沂市| 封丘县| 宜川县| 云阳县| 清新县| 于都县| 罗山县| 张家港市| 青海省| 琼结县| 南川市| 阜新市| 宁河县| 锦屏县| 抚宁县| 铜鼓县| 老河口市| 沾化县| 南京市| 林芝县| 桃园县| 柘荣县| 乐都县| 庆元县| 永和县| 蕲春县| 漾濞| 平阴县| 乐都县| 常熟市| 偃师市| 濮阳市| 家居| 凤城市|