Reviewed-by: Hajba, László Antal <laszlo-antal.hajba@t-systems.com> Co-authored-by: fanqinying <fanqinying@huawei.com> Co-committed-by: fanqinying <fanqinying@huawei.com>
66 KiB
Creating a VPC Endpoint
Function
This API is used to create a VPC endpoint for accessing a VPC endpoint service.
This API is asynchronous. 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. You can view the creation result by performing operations in Querying Details About a VPC Endpoint Service.
URI
POST /v1/{project_id}/vpc-endpoints
Parameter |
Mandatory |
Description |
|---|---|---|
project_id |
Yes |
Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request
- Parameter description
Table 2 Request parameters Parameter
Mandatory
Type
Description
subnet_id
No
NOTE:This parameter is mandatory to create an interface VPC endpoint.
String
Specifies the ID of the subnet in the VPC specified by vpc_id. The ID is in UUID format
For details, see response field id in Querying Subnet Details in the Virtual Private Cloud API Reference.
NOTE:- This parameter is mandatory only when you create a VPC endpoint for connecting to an interface VPC endpoint service.
- The CIDR block of the VPC subnet 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.
endpoint_service_id
Yes
String
Specifies the ID of the VPC endpoint service.
You can obtain the ID of the VPC endpoint service to be connected by performing operations in Querying Basic Information About a VPC Endpoint Service.
vpc_id
Yes
String
Specifies the ID of the VPC where the VPC endpoint is to be created.
For details, see response field id in Querying VPC Details in Virtual Private Cloud API Reference.
enable_dns
No
Boolean
Specifies whether to create a private domain name.
- true: A private domain name is created.
- false: A private domain name is not created.
The default value is false.
NOTE:When a VPC endpoint for connecting to a gateway VPC endpoint service is created, no private domain name is created no matter enable_dns is set to true or false.
tags
No
Array of objects
Lists the resource tags. For details, see Table 3.
A maximum of 20 tags can be added to each VPC endpoint.
routetables
No
Array of strings
Lists the IDs of route tables.
If you do not specify this parameter, the route table ID of the VPC is returned.
NOTE:This parameter is available only when you create a VPC endpoint for connecting to a gateway VPC endpoint service.
port_ip
No
NOTE:This parameter is mandatory only when you create a VPC endpoint for connecting to an interface VPC endpoint service.
String
Specifies the IP address for accessing the associated VPC endpoint service.
You can specify IP addresses for accessing the associated VPC endpoint service when creating a VPC endpoint. Only IPv4 addresses are supported.
whitelist
No
Array of strings
Specifies the whitelist for controlling access to the VPC endpoint.
IPv4 addresses or CIDR blocks can be specified to control access when you create a VPC endpoint.
NOTE:This parameter is available only when you create a VPC endpoint for connecting to an interface VPC endpoint service.
enable_whitelist
No
Boolean
Specifies whether access control is enabled.
- true: Access control is enabled.
- false: Access control is disabled.
The default value is false.
NOTE:This parameter is available only when you create a VPC endpoint for connecting to an interface VPC endpoint service.
specification_name
No
String
Specifies the name of the VPC endpoint specifications.
policy_statement
No
Array of PolicyStatement objects
Specifies the policy of the gateway VPC endpoint.
This parameter is available only when you create a gateway VPC endpoint.
Array length: 0–10
Default value:
{ "Action": [ "obs:*:*" ], "Resource": [ "obs:*:*:*:*/*", "obs:*:*:*:*" ], "Effect": "Allow" }ip_version
No
String
Specifies the IP version of the VPC endpoint. Only professional VPC endpoints support this parameter. This is a reserved parameter and is not supported currently.
enterprise_project_id
No
String
Specifies the enterprise project ID. When creating a VPC endpoint, you need to specify an enterprise project ID for it. The value is 0 or a string that contains a maximum of 36 bytes in the UUID format with hyphens (-). 0 indicates the default enterprise project.
edition
No
String
Specifies the VPC endpoint type. This is a reserved parameter and is not supported currently.
This parameter is available only when you create a VPC endpoint for accessing an interface VPC endpoint service.
The value can be:
- profession: professional VPC endpoints
- basic: basic VPC endpoints
description
No
String
Specifies the description of the VPC endpoint. The value can contain a maximum of 128 characters, including letters and digits. Angle brackets (< and >) are not allowed.
- Example request
POST https://{endpoint}/v1/{project_id}/vpc-endpointsCreating an interface VPC endpoint
{ "subnet_id": "61881173-3899-4981-a700-170253d469b6", "endpoint_service_id": "2da0fe8f-5cb7-4d93-bb35-dc05334da1be", "vpc_id": "d7b2bf07-1b4c-43fa-bd88-d80c6ebea140", "tags": [ { "key": "test2", "value": "test2" } ] }Creating a gateway VPC endpoint
{ "endpoint_service_id": "e4a21a61-f09e-41bc-b487-23d6204ae27b", "vpc_id": "d7b2bf07-1b4c-43fa-bd88-d80c6ebea140", "enable_dns": true, "tags": [ { "key": "test1", "value": "test1" } ], "routetables": [ "cd7fdf2b-d964-4a4a-a169-2af1112e7d02" ] }
Response
- Parameter description
Table 5 Response parameters Parameter
Type
Description
id
String
Specifies the unique ID of the VPC endpoint.
service_type
String
Specifies the type of the VPC endpoint service that is associated with the VPC endpoint.
- Gateway: VPC endpoint services of this type are configured by O&M personnel. You can use them directly without the need to create one by yourselves.
- Interface: VPC endpoint services of this type include cloud services configured by O&M personnel and private services created by yourselves. You cannot configure these cloud services, but can use them.
You can view those VPC endpoint services that are configured by operations people and are visible and accessible to all users. For detailed steps, see Querying Public VPC Endpoint Services. Perform the operations in Creating a VPC Endpoint Service to create an interface VPC endpoint service.
status
String
Specifies the connection status of the VPC endpoint.
- pendingAcceptance: The VPC endpoint is to be accepted.
- creating: The VPC endpoint is being created.
- accepted: The VPC endpoint has been accepted.
- rejected: The VPC endpoint has been rejected.
- failed: The VPC endpoint failed to be created.
active_status
Array of strings
Specifies the account status.
- arrear_frozen: frozen due to arrears
- verify_frozen: frozen due to lack of real-name authentication
- police_frozen: frozen for legal management
- illegal_frozen: frozen due to abuse
- partner_frozen: frozen for partnership
- active: The account is normal.
endpoint_service_name
String
Specifies the name of the VPC endpoint service.
marker_id
Integer
Specifies the packet ID of the VPC endpoint.
endpoint_service_id
String
Specifies the ID of the VPC endpoint service.
enable_dns
Boolean
Specifies whether to create a private domain name.
- true: A private domain name is created.
- false: A private domain name is not created.
NOTE:When a VPC endpoint for connecting to a gateway VPC endpoint service is created, no private domain name is created no matter enable_dns is set to true or false.
subnet_id
String
Specifies the ID of the subnet in the VPC specified by vpc_id. The ID is in UUID format.
NOTE:This parameter is available only when you create a VPC endpoint for connecting to an interface VPC endpoint service.
vpc_id
String
Specifies the ID of the VPC where the VPC endpoint is to be created.
created_at
String
Specifies the creation time of the VPC endpoint.
The UTC time format is used: YYYY-MM-DDTHH:MM:SSZ.
updated_at
String
Specifies the update time of the VPC endpoint.
The UTC time format is used: YYYY-MM-DDTHH:MM:SSZ.
project_id
String
Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID.
tags
Array of objects
Lists the resource tags. For details, see Table 6.
whitelist
Array of strings
Specifies the whitelist for controlling access to the VPC endpoint.
If you do not specify this parameter, an empty whitelist is returned.
NOTE:This parameter is available only when you create a VPC endpoint for connecting to an interface VPC endpoint service.
enable_whitelist
Boolean
Specifies whether access control is enabled.
- true: Access control is enabled.
- false: Access control is disabled.
If you do not specify this parameter, the whitelist is not enabled.
NOTE:This parameter is available only when you create a VPC endpoint for connecting to an interface VPC endpoint service.
routetables
Array of strings
Lists the IDs of route tables.
If you do not specify this parameter, the route table ID of the VPC is returned.
NOTE:This parameter is available only when you create a VPC endpoint for connecting to a gateway VPC endpoint service.
specification_name
String
Specifies the name of the VPC endpoint specifications.
enable_status
String
Specifies whether to enable the endpoint.
- enable: The endpoint will be enabled.
- disable: The endpoint will be disabled.
policy_statement
Array of PolicyStatement objects
Specifies the policy of the gateway VPC endpoint.
This parameter is available only when you create a gateway VPC endpoint.
Default value:
{ "Action": [ "obs:*:*" ], "Resource": [ "obs:*:*:*:*/*", "obs:*:*:*:*" ], "Effect": "Allow" }public_border_group
String
Specifies the public border group information about the pool of the VPC endpoint.
ip_version
String
Specifies the IP version of the VPC endpoint. Only professional VPC endpoints support this parameter. This is a reserved parameter and is not supported currently.
enterprise_project_id
String
Specifies the enterprise project ID. When creating a VPC endpoint, you need to specify an enterprise project ID for it.
The value is 0 or a string that contains a maximum of 36 bytes in the UUID format with hyphens (-). 0 indicates the default enterprise project.
edition
String
Specifies the VPC endpoint type. This is a reserved parameter and is not supported currently.
This parameter is available only when you create a VPC endpoint for accessing an interface VPC endpoint service.
The value can be:
- profession: professional VPC endpoints
- basic: basic VPC endpoints
endpoint_pool_id
String
(To be discarded) Specifies the ID of the cluster associated with the VPC endpoint.
description
String
Specifies the description of the VPC endpoint. The value can contain a maximum of 128 characters, including letters and digits. Angle brackets (< and >) are not allowed.
- Example response
An interface VPC endpoint has been created.
{ "id": "530d6f2f-d115-4df2-8c36-32d19f3c0bbc", "status": "creating", "tags": [ { "key": "test2", "value": "test2" } ], "whitelist": [], "marker_id": 201515772, "active_status": [ "active" ], "vpc_id": "d7b2bf07-1b4c-43fa-bd88-d80c6ebea140", "service_type": "interface", "project_id": "0df25bbc*****62f88c00c2959df9a", "subnet_id": "61881173-3899-4981-a700-170253d469b6", "enable_dns": false, "created_at": "2024-08-23T07:37:37Z", "updated_at": "2024-08-23T07:37:37Z", "endpoint_service_id": "2da0fe8f-5cb7-4d93-bb35-dc05334da1be", "endpoint_service_name": "test123", "enable_whitelist": false, "specification_name": "default", "enable_status": "enable", "description": "", "endpoint_pool_id": "0e796c11-6cf1-484a-9b8c-f837cb925287", "public_border_group": "center", "ip_version": "ipv4", "enterprise_project_id": "0", "edition": "basic" }A gateway VPC endpoint has been created.
{ "id": "093998ea-ebaa-440d-8c75-935178e4dd93", "status": "creating", "tags": [ { "key": "test1", "value": "test1" } ], "marker_id": 201414431, "active_status": [ "active" ], "vpc_id": "d7b2bf07-1b4c-43fa-bd88-d80c6ebea140", "service_type": "gateway", "project_id": "0df25bbc87****8c00c2959df9a", "routetables": [ "cd7fdf2b-d964-4a4a-a169-2af1112e7d02" ], "created_at": "2024-08-23T07:23:22Z", "updated_at": "2024-08-23T07:23:22Z", "endpoint_service_id": "e4a21a61-f09e-41bc-b487-23d6204ae27b" "endpoint_service_name": "test123", "policy_statement": [ { "Action": [ "obs:*:*" ], "Resource": [ "obs:*:*:*:*/*", "obs:*:*:*:*" ], "Effect": "Allow" } ], "specification_name": "default", "enable_status": "enable", "description": "", "endpoint_pool_id": "d86778c4-ad4b-4abd-988e-8c2572047fe4", "public_border_group": "center", "ip_version": "ipv4", "enterprise_project_id": "0", "edition": "basic" }
Status Codes
See Status Codes.
Error Codes
For details, see Error Codes.