If you have these three demands for the Virtual Machines in Availability Group:
Step 1: Create the Virtual Private Cloud and two subnets: Subnet 1 and Subnet 2. One of the subnets contains Availability Group, and the other contains the NAT instance.
Click Create button.
Set the name and description of Virtual Private Cloud in the popped-up Create virtual private cloud popup.
Set the name of this step as: "Web service".
Set the CIDR of Virtual Private Cloud: Set the boundary of the Virtual Private Cloud. CIDR can only be an intranet segment, and the optional scope is 10.0.0.0 (mask 16 ~ 28), 172.16.0.0 ~ 172.31.0.0 (mask 16 ~ 28), 192.168.0.0 (mask 16 ~ 28). CIDR presetting can be ignored. In this case, the boundary of vpc will automatically scale with the subnet segment therein. The user having deeply understood the network is suggested to select the Virtual Private Cloud without preset CIDR.
In this step, CIDR is set as the Virtual Private Cloud of 192.168.0.0/16, and is named as.
Click OK to view the Virtual Private Cloud created.
Select the region of the Virtual Private Cloud created just now, and click Create, so the Create Subnet popup pops up.
Select the "Web service" of the corresponding Virtual Private Cloud; the CIDR of a subnet can only be an intranet segment, and the optional scope is within the CIDR scope of "Web service". Here, 192.168.1.0/24 and 192.168.2.0/24 are assigned to subnets 1 and 2 respectively.
Set the name and description of the subnet.
Select the route table associated with subnets, each subnet can and must associate a route table. Please note that a separate route table, such as "Availability Group Route Table" is configured for subnet 1 with public network access requirement.
Click OK to trigger subnet creation.
Step 2: Create the NAT instance in Subnet 2, and assign the elastic IP for the instance. The IP is the fixed IP address for the Virtual Machines in Availability Group to access the public network.
Refer to Create Linux instances for the detailed steps for creating NAT instances. It is only required to select the CentOS 7.2 64-bit NAT Gateway in public images.
Step 3: Configure the Virtual Private Cloud route table to guide the public network flow of Subnet 1 to the NAT instance.
Step 4: Availability Group is created based on Subnet 1, and new instances shall be added to Availability Group.
Now you need to create Availability Group for your business. Refer to Quick Start for Availability Group for the detailed steps.
Please note that the Virtual Private Cloud of Availability Group shall be the same as that of the NAT instance, but the subnet shall be different.
So, the Virtual Machines in Availability Group can access the public network through the elastic IP configured by the NAT instance.