Creating a VPC Endpoint Service
Function
Function This API is used to create a VPC endpoint service. Other users can create a VPC endpoint to connect to the endpoint service. Note: This API is an asynchronous interface. If it is successfully invoked, status code 200 is returned, indicating that the request has been successfully delivered. It takes 1 to 2 minutes to create a VPC endpoint service. You can view the creation result by querying the details of the VPC endpoint service.
URI
POST /v1/{project_id}/vpc-endpoint-services
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. Minimum: 1 Maximum: 64 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies the user token. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication.The value of X-Subject-Token in the response header is the token value. Minimum: 1 Maximum: 2048 |
Content-Type |
Yes |
String |
Specifies the MIME type of the request body. Default value application/json is recommended. For APIs used to upload objects or images, the MIME type varies depending on the flow type. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
port_id |
Yes |
String |
Specifies the ID of the backend resource of the VPC endpoint service. The ID is in the universally unique identifier (UUID) format. The options are as follows: ● Load balancer: Specifies the port ID of the private IP address of the shared load balancer. For details, see the vip_port_id field in the response parameters of section "Viewing Details of a Load Balancer" in the Elastic Load Balance API Reference. ● Virtual machine: Specifies the NIC ID of the ECS IP address. For details, see the port_id field in the response parameters of the section "Querying NICs of an ECS" in the Elastic Cloud Server API Reference. ● Virtual IP address: Specifies the NIC ID of the physical server where the virtual resource is located. Note: ● When you create a VPC endpoint service, the subnet CIDR block of the VPC cannot overlap with 198.19.128.0/17. ● The destination address of the custom route in the VPC route table cannot overlap with 198.19.128.0/17. |
vip_port_id |
No |
String |
NIC ID of the virtual IP address. |
service_name |
No |
String |
Specifies the name of the VPC endpoint service. The name can contain a maximum of 16 characters, including letters, digits, underscores (_), and hyphens (-). ● If the service_name is left blank, the generated value is regionName+.+serviceId. ● If the service_name is specified and the verification is approved, the generated is regionName+.+serviceName+.+serviceId. |
vpc_id |
Yes |
String |
Specifies the ID of the VPC where the backend resource of the VPC endpoint service is located. For details, see the id field in the response information of the section "Querying VPC Details" in the Virtual Private Cloud API Reference. |
approval_enabled |
No |
Boolean |
Specifies whether approval is required. ● false: No approval is required. The created VPC endpoint is in the accepted state by default. ● true: Approval is required. The created VPC endpoint is in the pendingAcceptance state and can be used only after being approved by the user of the VPC endpoint service. The default value is true. Default: true |
service_type |
No |
String |
Specifies the type of the VPC endpoint service. Only your private services can be configured into interface VPC endpoint services. There are two types of VPC endpoint services: interface and gateway. ● gateway: VPC endpoint services of this type are configured by O&M personnel. You can use them directly without creating them by yourselves. ● interface: Cloud services configured by O&M personnel and private services created by yourselves are included. You cannot configure these cloud services, but can use them. You can query public VPC endpoint services to view the VPC endpoint services that are visible and accessible to all users configured by O&M personnel. You can create a VPC endpoint for accessing gateway and interface VPC endpoint services. Default: interface |
server_type |
Yes |
String |
Specifies the resource type. ● VM: indicates the cloud server, which can be used as a server. ● VIP: indicates the virtual IP address, which is applicable to be used as physical servers for virtual resources. ● LB: indicates the shared load balancer, which is applicable to services with high access traffic and services that require high reliability and disaster recovery. |
ports |
Yes |
Array of PortList objects |
Specifies the port mappings opened by the VPC endpoint service. Duplicate port mappings are not allowed in the same VPC endpoint service. If multiple VPC endpoint services share one port ID, the combinations of server ports and protocols for all port mappings between VPC endpoint services must be unique. A maximum of 200 port mappings can be added at a time. |
tcp_proxy |
No |
String |
Specifies whether the client information, such as IP address, port number, and marker_id, is transmitted to the server. The following methods are supported: ● TCP TOA: transmits the client information inserted in the tcp option field to the server. Note: TCP TOA is supported only when the backend resource type is Object Storage Service (OBS). ● Proxy Protocol: transmits the client information inserted in the tcp payload field to the server. tcp_proxy is available only when the server can parse fields tcp option and tcp payload. The values are as follows: ● close: indicates that the proxy protocol is disabled. ● toa_open: indicates that the proxy protocol tcp_toa is enabled. ● proxy_open: indicates that the proxy protocol proxy_protocol is enabled. ● open: indicates that both tcp_toa and proxy_protocol are enabled. The default value is close. Default: close |
tags |
No |
Array of TagList objects |
Resource tag list A maximum of 10 tags can be added to a VPC endpoint service. |
description |
No |
String |
Specifies the description field. The value can contain characters such as letters and digits, but cannot contain less than signs (<) and great than signs (>). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
client_port |
No |
Integer |
Specifies the port to be accessed by a VPC endpoint. This port is provided by the VPC endpoint, allowing you to access the VPC endpoint service. Supported range: 1 to 65535. Minimum: 1 Maximum: 65535 |
server_port |
No |
Integer |
Specifies the port for accessing the VPC endpoint service. This port is associated with backend resources to provide VPC endpoint services. Supported range: 1 to 65535 Minimum: 1 Maximum: 65535 |
protocol |
No |
String |
Port mapping protocol. TCP is supported. Default: TCP |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
No |
String |
Specifies the tag key. A tag key contains a maximum of 36 Unicode characters. It cannot be left blank. It cannot contain equal signs (=), asterisks (*), less than signs (<), greater than signs (>), backslashes (), commas (,), vertical bars (|), and slashes (/), and the first and last characters cannot be spaces. Minimum: 1 Maximum: 36 |
value |
No |
String |
Specifies the tag key. A tag value contains a maximum of 43 Unicode characters and can be an empty string. It cannot contain equal signs (=), asterisks (*), less than signs(<), greater than signs (>), backslashes (), commas (,), vertical bars (|), and slashes (/), and the first and last characters cannot be spaces. Minimum: 1 Maximum: 43 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
id |
String |
Specifies the unique ID of the VPC endpoint service. |
port_id |
String |
Specifies the ID of the backend resource of the VPC endpoint service. The ID is in the universally unique identifier (UUID) format. The options are as follows: ● Load balancer: Specifies the port ID of the private IP address of the shared load balancer. ● Virtual machine: Specifies the NIC ID of the ECS IP address. ● Virtual IP address: Specifies the NIC ID of the physical server where the virtual resource is located. |
vip_port_id |
String |
Specifies the ID of the virtual NIC to which the virtual IP address is bound. This parameter is returned only when port_id is set to VIP. |
service_name |
String |
Specifies the name of the VPC endpoint service. Minimum: 0 Maximum: 128 |
server_type |
String |
Specifies the resource type. ● VM: indicates a cloud server. ● VIP: indicates a virtual IP address. ● LB: indicates a shared load balancer. |
vpc_id |
String |
Specifies the ID of the VPC to which the backend resource of the VPC endpoint service belongs. |
pool_id |
String |
Specifies the cluster ID of the VPC endpoint service. |
approval_enabled |
Boolean |
Specifies whether approval is required. ● false: No approval is required. The created VPC endpoint is in the accepted state by default. ● true: Approval is required. The created VPC endpoint is in the pendingAcceptance state, and can be used only after being approved by the user of the VPC endpoint service. |
status |
String |
Specifies the status of the VPC endpoint service. ● creating: The VPC endpoint service is being created. ● available: The VPC endpoint service can be connected. ● failed: The VPC endpoint service fails to be created. |
service_type |
String |
Specifies the type of the VPC endpoint service. There are two types of VPC endpoint services: interface and gateway. ● gateway: VPC endpoint services of this type are configured by O&M personnel. You can use them directly without creating them by yourselves. ● interface: Cloud services configured by O&M personnel and private services created by yourselves are included. Cloud services configured by O&M personnel do not need to be created. You can use it directly. You can create a VPC endpoint for accessing gateway and interface VPC endpoint services. |
created_at |
String |
Specifies the creation time of the VPC endpoint service. The applied UTC time format is YYYY-MMDDTHH:MM:SSZ. |
updated_at |
String |
Specifies the update time of the VPC endpoint service. The applied UTC time format is YYYY-MMDDTHH:MM:SSZ. |
project_id |
String |
Project ID |
cidr_type |
String |
Specifies the CIDR block type. ● public: indicates a public CIDR block. ● internal: indicates a private CIDR block. The default value is internal. |
ports |
Array of PortList objects |
Specifies the port mappings opened by the VPC endpoint service. Duplicate port mappings are not allowed in the same VPC endpoint service. If multiple VPC endpoint services share one port ID,the combinations of server ports and protocols for all port mappings between VPC endpoint services must be unique. |
tcp_proxy |
String |
Specifies whether the client information, such as IP address, port number, and marker_id, is transmitted to the server. The following methods are supported: ● TCP TOA: transmits the client information inserted in the tcp option field to the server. Note: TCP TOA is supported only when the backend resource type is Object Storage Service (OBS). ● Proxy Protocol: transmits the client information inserted in the tcp payload field to the server. tcp_proxy is available only when the server can parse fields tcp option and tcp payload. The values are as follows: ● close: indicates that the proxy protocol is disabled. ● toa_open: indicates that the proxy protocol tcp_toa is enabled. ● proxy_open: indicates that the proxy protocol proxy_protocol is enabled. ● open: indicates that both tcp_toa and proxy_protocol are enabled. The default value is close. |
tags |
Array of TagList objects |
Resource tag list |
description |
String |
Specifies the description field. The value can contain characters such as letters and digits, but cannot contain less than signs (<) and great than signs (>). |
Parameter |
Type |
Description |
---|---|---|
client_port |
Integer |
Specifies the port to be accessed by a VPC endpoint. This port is provided by the VPC endpoint, allowing you to access the VPC endpoint service. Supported range: 1 to 65535. Minimum: 1 Maximum: 65535 |
server_port |
Integer |
Specifies the port for accessing the VPC endpoint service. This port is associated with backend resources to provide VPC endpoint services. Supported range: 1 to 65535 Minimum: 1 Maximum: 65535 |
protocol |
String |
Port mapping protocol. TCP is supported. Default: TCP |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Specifies the tag key. A tag key contains a maximum of 36 Unicode characters. It cannot be left blank. It cannot contain equal signs (=), asterisks (*), less than signs (<), greater than signs (>), backslashes (), commas (,), vertical bars (|), and slashes (/), and the first and last characters cannot be spaces. Minimum: 1 Maximum: 36 |
value |
String |
Specifies the tag key. A tag value contains a maximum of 43 Unicode characters and can be an empty string. It cannot contain equal signs (=), asterisks (*), less than signs(<), greater than signs (>), backslashes (), commas (,), vertical bars (|), and slashes (/), and the first and last characters cannot be spaces. Minimum: 1 Maximum: 43 |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 405
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 406
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 407
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 408
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 409
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 501
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 502
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 503
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Parameter |
Type |
Description |
---|---|---|
message |
String |
Task error description |
code |
String |
Error code of a task exception. |
Status code: 504
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Specifies the error message returned when a task submission exception occurs. |
Example Requests
POST https://{endpoint}/v1/{project_id}/vpc-endpoint-services { "port_id" : "4189d3c2-8882-4871-a3c2-d380272eed88", "vpc_id" : "4189d3c2-8882-4871-a3c2-d380272eed80", "approval_enabled" : false, "service_type" : "interface", "server_type" : "VM", "ports" : [ { "client_port" : 8080, "server_port" : 90, "protocol" : "TCP" }, { "client_port" : 8081, "server_port" : 80, "protocol" : "TCP" } ] }
Example Responses
Status code: 200
The server has successfully processed the request.
{ "id" : "4189d3c2-8882-4871-a3c2-d380272eed83", "port_id" : "4189d3c2-8882-4871-a3c2-d380272eed88", "vpc_id" : "4189d3c2-8882-4871-a3c2-d380272eed80", "pool_id" : "5289d3c2-8882-4871-a3c2-d380272eed80", "status" : "available", "approval_enabled" : false, "service_name" : "test123", "service_type" : "interface", "server_type" : "VM", "project_id" : "6e9dfd51d1124e8d8498dce894923a0d", "created_at" : "2022-04-14T09:35:47Z", "ports" : [ { "client_port" : 8080, "server_port" : 90, "protocol" : "TCP" }, { "client_port" : 8081, "server_port" : 80, "protocol" : "TCP" } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
The server has successfully processed the request. |
400 |
The request could not be understood by the server due to malformed syntax. |
401 |
The requested page requires a user name and password. |
403 |
The server understood the request, but is refusing to fulfill it. |
404 |
The server has not found anything matching the request URI. |
405 |
The method specified in the request line is not allowed for the resource identified by the request URI. |
406 |
The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request. |
407 |
The client must first authenticate itself with the proxy. |
408 |
The client did not produce a request within the time that the server was prepared to wait. |
409 |
The request could not be completed due to a conflict with the current state of the resource. |
500 |
Failed to complete the request. Service abnormality. |
501 |
Failed to complete the request. The server does not support the requested function. |
502 |
Failed to complete the request. because the server has received an invalid response. |
503 |
Failed to complete the request. because the system is unavailable. |
504 |
Gateway Timeout |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.