This topic describes how to use OpenAPI to call NAT Gateway operations, including the descriptions of versions, endpoints, styles, and call methods.
NAT Gateway and Virtual Private Cloud use the same endpoint.
OpenAPI Explorer introduction
Alibaba Cloud provides OpenAPI Explorer for you to efficiently understand and use the API operations of various Alibaba Cloud services. OpenAPI Explorer integrates the following features with API operations: intelligent search, documentation, online debugging, SDK obtaining, sample code, call error diagnostics, and call statistics. In OpenAPI Explorer, you can call API operations of Alibaba Cloud services and view API requests and responses. OpenAPI Explorer can also automatically generate SDK sample code to help you use Alibaba Cloud services. For more information, see What is OpenAPI?
Versions
Alibaba Cloud OpenAPI Explorer manages the versions of Alibaba Cloud service APIs by version number. For example, NAT Gateway supports the API of the 2016-04-28
version. 2016-04-28
is an API version number but not a date. Users are provided with the latest public information about the API. 2016-04-28
is the up-to-date version of the NAT Gateway API.
API version | Description |
We recommend that you use this version. |
Online debugging
NAT Gateway provides features such as API debugging in OpenAPI Explorer. Before you call API operations, you must understand the following information provided by NAT Gateway: versions, endpoints, and integration methods.
Debugging page
Endpoints
The NAT Gateway API supports multiple access points. For more information, see Endpoints.
Supported user identities
After you log on to OpenAPI Explorer by using your Alibaba Cloud account, OpenAPI Explorer uses your Alibaba Cloud account to perform online debugging by default. An Alibaba Cloud account has permissions on all API operations. Security risks may arise if you use an Alibaba Cloud account to call API operations. We recommend that you call API operations or perform routine O&M as a Resource Access Management (RAM) user. Before you call API operations as a RAM user, grant the required permissions to the RAM user. The RAM user must have the permissions on NAT Gateway resources. For more information, see Use RAM to implement access control.
User identity | Supported |
Yes | |
RAM user (recommended) | Yes |
RAM role (recommended) | Yes |
References
For more information about OpenAPI Explorer user identities, credentials, authorization, traffic control, and quotas, see the following topics.
Integration methods
SDKs can be easily integrated with your applications and cover the widest range of operations. We recommend that you use SDKs to call API operations.
Integration method | Supported |
Alibaba Cloud SDK | Yes |
Alibaba Cloud CLI | Yes |
Resource Orchestration Service (ROS) | Yes |
Terraform | Yes |
Alibaba Cloud SDK
Alibaba Cloud provides SDKs in multiple programming languages, such as Java, C#, Go, Python, Node.js, TypeScript, PHP, and C++. You can integrate the SDKs with your applications to directly call API operations. SDKs encapsulate the signature logic, timeout mechanism, and retry mechanism and provide the request and response objects that facilitate development. For more information, see Alibaba Cloud SDKs.
You can use Alibaba Cloud SDKs to call API operations in OpenAPI Explorer. For more information about the supported programming languages and how to install dependencies, see VPC SDKs.
Alibaba Cloud CLI
You can run
aliyun
commands to interact with Alibaba Cloud services and manage cloud service resources. For more information, see What is Alibaba Cloud CLI?Terraform
Terraform is an open source tool that is used to preview, configure, and manage cloud infrastructure and resources in a secure and efficient manner. Terraform works by a similar mechanism as ROS. It calls API operations by interpreting templates. For more information, see What is Terraform?
ROS
ROS is an Alibaba Cloud service that can simplify the management of cloud computing resources. You can create a template to describe the cloud computing resources such as Elastic Compute Service (ECS) and ApsaraDB RDS instances that you need, as well as the relationship between the resources. ROS automatically creates and configures all resources based on the template to implement automated deployment and O&M. For more information, see What is ROS?.
You can use ROS to call NAT Gateway operations. Some orchestrated resources:
ALIYUN::VPC::NatGateway: creates a NAT gateway.
ALIYUN::VPC::SnatEntry: adds an SNAT entry to an SNAT table.
ALIYUN::VPC::NatIp: creates a NAT IP address.
ALIYUN::VPC::NatIpCidr: creates a NAT CIDR block.
DATASOURCE::VPC::NatGateways: queries NAT gateways.
DATASOURCE::VPC::NatGatewayZones: queries the zones of a NAT gateway.
DATASOURCE::VPC::NatIpCidrs: queries NAT CIDR blocks.
Custom API encapsulation
To make native HTTP calls, you must construct custom requests and sign the requests. For more information about the signature mechanism, see List of operations by function and Request syntax and signature method V3.
Usage notes
If an error is returned after you call an API operation, you must check whether the values of the request parameters are valid based on the returned error code.
You can also use the Alibaba Cloud OpenAPI Diagnostics platform to perform self-service diagnostics based on the returned request ID or SDK error message.