This topic describes how to create an Internet NAT gateway, attach an Elastic IP Address (EIP), and configure an SNAT entry in the virtual private cloud (VPC) that is associated with your personal development environment. This configuration allows the personal development environment to access the Internet through the Internet NAT gateway.
Function Introduction
By default, a personal development environment can access the Internet if no VPC is configured, but it does not have a fixed public IP address. If you need a fixed public IP address, or if you have already configured a VPC, you can attach an EIP to an Internet NAT gateway to enable Internet access through the VPC.
Procedure
Create an Internet NAT gateway. The key parameters are described below. For more information about other parameter settings, see Internet NAT Gateway.
If your VPC contains multiple Internet NAT gateways, see Deploy multiple Internet NAT gateways in one VPC for network design and deployment solutions.
Parameter
Value
Region
Select the same region as your personal development environment.
VPC
Select the VPC and VSwitch that are attached to the personal development environment.

Associate VSwitch
Access Mode
Select Unified Access Mode (SNAT). An SNAT entry is configured for your VPC by default.
Elastic IP Address
Purchase a new Elastic IP Address.
Service-linked Role Creation
If you are creating a NAT Gateway for the first time, you must create a service-linked role. Click Create Service-linked Role.
On the Internet NAT Gateway page, click the name of the gateway instance to open the Basic Information tab. Then, click the SNAT Management tab and verify that the SNAT entry was created.

If no SNAT entry exists, create one in the gateway. When you create the entry, set Granularity to VPC and select an IP address. If you have multiple IP addresses, you can select more than one. For more information, see Use the SNAT feature of an Internet NAT gateway to access the Internet.
Test the connectivity.
Switch to the personal development environment. In the lower-left corner, click the
icon and select Command Palette. In the Command Palette, search for Terminal.
In the terminal, run the
ping www.aliyun.comcommand to test the network connectivity.If you receive response messages, this indicates that the personal development environment can access the Internet through the Internet NAT gateway.
Tests confirm that the personal development environment can access the Internet through a dedicated Internet gateway.
/mnt/workspace> ping www.aliyun.com PING www.aliyun.com.w.cdngslb.com (183.146.XX.XX): 56 data bytes 64 bytes from 183.146.XX.XX: icmp_seq=0 ttl=53 time=12.245 ms 64 bytes from 183.146.XX.XX: icmp_seq=1 ttl=53 time=12.164 ms 64 bytes from 183.146.XX.XX: icmp_seq=2 ttl=53 time=12.097 ms 64 bytes from 183.146.XX.XX: icmp_seq=3 ttl=53 time=12.127 ms 64 bytes from 183.146.XX.XX: icmp_seq=4 ttl=53 time=12.266 ms 64 bytes from 183.146.XX.XX: icmp_seq=5 ttl=53 time=12.164 ms