Use DescribeVpcEndpoints with an Amazon SDK or CLI - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use DescribeVpcEndpoints with an Amazon SDK or CLI

The following code examples show how to use DescribeVpcEndpoints.

CLI
Amazon CLI

To describe your VPC endpoints

The following describe-vpc-endpoints example displays details for all of your VPC endpoints.

aws ec2 describe-vpc-endpoints

Output:

{ "VpcEndpoints": [ { "PolicyDocument": "{\"Version\":\"2008-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"*\",\"Resource\":\"*\"}]}", "VpcId": "vpc-aabb1122", "NetworkInterfaceIds": [], "SubnetIds": [], "PrivateDnsEnabled": true, "State": "available", "ServiceName": "com.amazonaws.us-east-1.dynamodb", "RouteTableIds": [ "rtb-3d560345" ], "Groups": [], "VpcEndpointId": "vpce-032a826a", "VpcEndpointType": "Gateway", "CreationTimestamp": "2017-09-05T20:41:28Z", "DnsEntries": [], "OwnerId": "123456789012" }, { "PolicyDocument": "{\n \"Statement\": [\n {\n \"Action\": \"*\", \n \"Effect\": \"Allow\", \n \"Principal\": \"*\", \n \"Resource\": \"*\"\n }\n ]\n}", "VpcId": "vpc-1a2b3c4d", "NetworkInterfaceIds": [ "eni-2ec2b084", "eni-1b4a65cf" ], "SubnetIds": [ "subnet-d6fcaa8d", "subnet-7b16de0c" ], "PrivateDnsEnabled": false, "State": "available", "ServiceName": "com.amazonaws.us-east-1.elasticloadbalancing", "RouteTableIds": [], "Groups": [ { "GroupName": "default", "GroupId": "sg-54e8bf31" } ], "VpcEndpointId": "vpce-0f89a33420c1931d7", "VpcEndpointType": "Interface", "CreationTimestamp": "2017-09-05T17:55:27.583Z", "DnsEntries": [ { "HostedZoneId": "Z7HUB22UULQXV", "DnsName": "vpce-0f89a33420c1931d7-bluzidnv.elasticloadbalancing.us-east-1.vpce.amazonaws.com" }, { "HostedZoneId": "Z7HUB22UULQXV", "DnsName": "vpce-0f89a33420c1931d7-bluzidnv-us-east-1b.elasticloadbalancing.us-east-1.vpce.amazonaws.com" }, { "HostedZoneId": "Z7HUB22UULQXV", "DnsName": "vpce-0f89a33420c1931d7-bluzidnv-us-east-1a.elasticloadbalancing.us-east-1.vpce.amazonaws.com" } ], "OwnerId": "123456789012" }, { "VpcEndpointId": "vpce-aabbaabbaabbaabba", "VpcEndpointType": "GatewayLoadBalancer", "VpcId": "vpc-111122223333aabbc", "ServiceName": "com.amazonaws.vpce.us-east-1.vpce-svc-123123a1c43abc123", "State": "available", "SubnetIds": [ "subnet-0011aabbcc2233445" ], "RequesterManaged": false, "NetworkInterfaceIds": [ "eni-01010120203030405" ], "CreationTimestamp": "2020-11-11T08:06:03.522Z", "Tags": [], "OwnerId": "123456789012" } ] }

For more information, see VPC endpoints in the Amazon VPC User Guide.

PowerShell
Tools for PowerShell

Example 1: This example describes one or more of your VPC endpoints for the region eu-west-1. It then pipes the output to the next command, which select the VpcEndpointId property and returns array VPC ID as string array

Get-EC2VpcEndpoint -Region eu-west-1 | Select-Object -ExpandProperty VpcEndpointId

Output:

vpce-01a2ab3f4f5cc6f7d vpce-01d2b345a6787890b vpce-0012e34d567890e12 vpce-0c123db4567890123

Example 2: This example describes all the vpc endpoints for the region eu-west-1 and selects VpcEndpointId, VpcId, ServiceName and PrivateDnsEnabled properties to present it in a tabular format

Get-EC2VpcEndpoint -Region eu-west-1 | Select-Object VpcEndpointId, VpcId, ServiceName, PrivateDnsEnabled | Format-Table -AutoSize

Output:

VpcEndpointId VpcId ServiceName PrivateDnsEnabled ------------- ----- ----------- ----------------- vpce-02a2ab2f2f2cc2f2d vpc-0fc6ff46f65b039eb com.amazonaws.eu-west-1.ssm True vpce-01d1b111a1114561b vpc-0fc6ff46f65b039eb com.amazonaws.eu-west-1.ec2 True vpce-0011e23d45167e838 vpc-0fc6ff46f65b039eb com.amazonaws.eu-west-1.ec2messages True vpce-0c123db4567890123 vpc-0fc6ff46f65b039eb com.amazonaws.eu-west-1.ssmmessages True

Example 3: This example exports the policy document for the VPC Endpoint vpce-01a2ab3f4f5cc6f7d into a json file

Get-EC2VpcEndpoint -Region eu-west-1 -VpcEndpointId vpce-01a2ab3f4f5cc6f7d | Select-Object -expand PolicyDocument | Out-File vpce_policyDocument.json

For a complete list of Amazon SDK developer guides and code examples, see Create Amazon EC2 resources using an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.