CreateVpcEndpoint - Amazon Elastic Compute Cloud

CreateVpcEndpoint

Creates a VPC endpoint. A VPC endpoint provides a private connection between the specified VPC and the specified endpoint service. You can use an endpoint service provided by AWS, an AWS Marketplace Partner, or another AWS account. For more information, see the AWS PrivateLink User Guide.

Use DescribeVpcEndpointServices to list the supported services.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

ClientToken

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to ensure idempotency.

Type: String

Required: No

DnsOptions

The DNS options for the endpoint.

Type: DnsOptionsSpecification object

Required: No

DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No

IpAddressType

The IP address type for the endpoint.

Type: String

Valid Values: ipv4 | dualstack | ipv6

Required: No

PolicyDocument

(Interface and gateway endpoints) A policy to attach to the endpoint that controls access to the service. The policy must be in valid JSON format. If this parameter is not specified, we attach a default policy that allows full access to the service.

Type: String

Required: No

PrivateDnsEnabled

(Interface endpoint) Indicates whether to associate a private hosted zone with the specified VPC. The private hosted zone contains a record set for the default public DNS name for the service for the Region (for example, kinesis.us-east-1.amazonaws.com), which resolves to the private IP addresses of the endpoint network interfaces in the VPC. This enables you to make requests to the default public DNS name for the service instead of the public DNS names that are automatically generated by the VPC endpoint service.

To use a private hosted zone, you must set the following VPC attributes to true: enableDnsHostnames and enableDnsSupport. Use ModifyVpcAttribute to set the VPC attributes.

Default: true

Type: Boolean

Required: No

RouteTableId.N

(Gateway endpoint) The route table IDs.

Type: Array of strings

Required: No

SecurityGroupId.N

(Interface endpoint) The IDs of the security groups to associate with the endpoint network interfaces. If this parameter is not specified, we use the default security group for the VPC.

Type: Array of strings

Required: No

ServiceName

The name of the endpoint service.

Type: String

Required: Yes

SubnetConfiguration.N

The subnet configurations for the endpoint.

Type: Array of SubnetConfiguration objects

Required: No

SubnetId.N

(Interface and Gateway Load Balancer endpoints) The IDs of the subnets in which to create endpoint network interfaces. For a Gateway Load Balancer endpoint, you can specify only one subnet.

Type: Array of strings

Required: No

TagSpecification.N

The tags to associate with the endpoint.

Type: Array of TagSpecification objects

Required: No

VpcEndpointType

The type of endpoint.

Default: Gateway

Type: String

Valid Values: Interface | Gateway | GatewayLoadBalancer

Required: No

VpcId

The ID of the VPC.

Type: String

Required: Yes

Response Elements

The following elements are returned by the service.

clientToken

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Type: String

requestId

The ID of the request.

Type: String

vpcEndpoint

Information about the endpoint.

Type: VpcEndpoint object

Errors

For information about the errors that are common to all actions, see Common client error codes.

Examples

Example 1

This example creates a gateway endpoint between vpc-1a2b3c4d and Amazon S3 in us-east-1, and associates route table rtb-11aa22bb with the endpoint.

Sample Request

https://ec2.amazonaws.com/?Action=CreateVpcEndpoint &VpcId=vpc-1a2b3c4d &ServiceName=com.amazonaws.us-east-1.s3 &RouteTableId.1=rtb-11aa22bb &AUTHPARAMS

Sample Response

<CreateVpcEndpointResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <vpcEndpoint> <vpcId>vpc-1a2b3c4d</vpcId> <state>available</state> <routeTableIdSet> <item>rtb-11aa22bb</item> </routeTableIdSet> <vpcEndpointId>vpce-abc12345</vpcEndpointId> <creationTimestamp>2015-02-20T16:46:40Z</creationTimestamp> <policyDocument>{"Version":"2008-10-17","Statement":[{"Sid":"","Effect":"Allow","Principal":"*","Action":"*","Resource":"*"}]}</policyDocument> <serviceName>com.amazonaws.us-west-1.s3</serviceName> </vpcEndpoint> <requestId>4b373100-473a-46a0-9006-example</requestId> </CreateVpcEndpointResponse>

Example 2

This example creates an interface endpoint between vpc-1a2b3c4d and Elastic Load Balancing in us-east-1 in subnet subnet-1a2b3c4d, and associates security group sg-11aa22bb with the network interface.

Sample Request

https://ec2.amazonaws.com/?Action=CreateVpcEndpoint &VpcId=vpc-1a2b3c4d &ServiceName=com.amazonaws.us-east-1.elasticloadbalancing &VpcEndpointType=Interface &SubnetId.1=subnet-1a2b3c4d &SecurityGroupId.1=sg-11aa22bb &AUTHPARAMS

Sample Response

<CreateVpcEndpointResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>bf5a49f9-4c36-41c9-a4be-13dexample</requestId> <vpcEndpoint> <policyDocument>{ "Statement": [ { "Action": "*", "Effect": "Allow", "Principal": "*", "Resource": "*" } ] }</policyDocument> <routeTableIdSet/> <dnsEntrySet> <item> <hostedZoneId>Z7HUB22UULQXV</hostedZoneId> <dnsName>vpce-0324151a02f327ff5-3k8nfxtt.elasticloadbalancing.us-east-1.vpce.amazonaws.com</dnsName> </item> <item> <hostedZoneId>Z7HUB22UULQXV</hostedZoneId> <dnsName>vpce-0324151a02f327ff5-3k8nfxtt-us-east-1a.elasticloadbalancing.us-east-1.vpce.amazonaws.com</dnsName> </item> <item> <hostedZoneId>Z2THV5YBYUN78V</hostedZoneId> <dnsName>elasticloadbalancing.us-east-1.amazonaws.com</dnsName> </item> </dnsEntrySet> <serviceName>com.amazonaws.us-east-1.elasticloadbalancing</serviceName> <privateDnsEnabled>true</privateDnsEnabled> <groupSet> <item> <groupName>default</groupName> <groupId>sg-11aa22bb</groupId> </item> </groupSet> <vpcEndpointId>vpce-0324151a02f327ff5</vpcEndpointId> <subnetIdSet> <item>subnet-1a2b3c4d</item> </subnetIdSet> <networkInterfaceIdSet> <item>eni-cd1a3319</item> </networkInterfaceIdSet> <vpcEndpointType>Interface</vpcEndpointType> <vpcId>vpc-1a2b3c4d</vpcId> <creationTimestamp>2017-09-05T20:57:46.307Z</creationTimestamp> <state>pending</state> </vpcEndpoint> </CreateVpcEndpointResponse>

Example 3

This example creates a Gateway Load Balancer endpoint between vpc-11122223333344445 and a VPC endpoint service that's configured using a Gateway Load Balancer.

Sample Request

https://ec2.amazonaws.com/?Action=CreateVpcEndpoint &VpcId=vpc-11122223333344445 &ServiceName=com.amazonaws.vpce.us-east-1.vpce-svc-123abcc1298abc123 &VpcEndpointType=GatewayLoadBalancer &SubnetId.1=subnet-aaaa1111bbbb22233 &AUTHPARAMS

Sample Response

<CreateVpcEndpointResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>bf5a49f9-4c36-41c9-a4be-13dexample</requestId> <vpcEndpoint> <ownerId>123456789012</ownerId> <requesterManaged>false</requesterManaged> <serviceName>com.amazonaws.vpce.us-east-1.vpce-svc-123abcc1298abc123</serviceName> <vpcEndpointId>vpce-bbbbbb2222222333</vpcEndpointId> <subnetIdSet> <item>subnet-aaaa1111bbbb22233</item> </subnetIdSet> <networkInterfaceIdSet> <item>eni-11111111222222aaa</item> </networkInterfaceIdSet> <vpcEndpointType>GatewayLoadBalancer</vpcEndpointType> <vpcId>vpc-11122223333344445</vpcId> <creationTimestamp>2020-11-11T08:06:03.522Z</creationTimestamp> <state>pending</state> </vpcEndpoint> </CreateVpcEndpointResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: