Sub topic 11
Creating an interface endpoint in a consumer VPC
This chapter assumes you know subnets, security groups, and the AWS CLI. It also assumes a provider has already published an endpoint service from a Network Load Balancer, as in the previous chapter. Here you work in the consumer account.
What an interface endpoint is
An interface endpoint is a set of elastic network interfaces (ENIs) in your subnets. Each ENI gets a private IP address from the subnet's range. Traffic sent to those IPs travels over AWS's network to the provider's Network Load Balancer. No peering, transit gateway, or internet path is involved. The consumer VPC and provider VPC may even use overlapping CIDR ranges.
Traffic flows in one direction only. Consumers start connections to the provider. The provider cannot start connections into the consumer VPC.
Create the endpoint
You need the service name from the provider. It looks like com.amazonaws.vpce.us-east-1.vpce-svc-0123456789abcdef0.
aws ec2 create-vpc-endpoint \
--vpc-endpoint-type Interface \
--vpc-id vpc-0aaa1111bbb22222c \
--service-name com.amazonaws.vpce.us-east-1.vpce-svc-0123456789abcdef0 \
--subnet-ids subnet-0aaa1111 subnet-0bbb2222 \
--security-group-ids sg-0123456789abcdef0Choose one subnet in each Availability Zone you want to use. Each subnet gets one ENI. If the provider's service is not available in a zone you pick, the call fails. Ask the provider which zones it supports.
Accept the connection
The provider created the service with --acceptance-required. The new endpoint therefore starts in the pendingAcceptance state. The provider approves it:
aws ec2 accept-vpc-endpoint-connections \
--service-id vpce-svc-0123456789abcdef0 \
--vpc-endpoint-ids vpce-0123456789abcdef0Check the state from the consumer side. Wait for available.
aws ec2 describe-vpc-endpoints \
--vpc-endpoint-ids vpce-0123456789abcdef0 \
--query "VpcEndpoints[0].[State,DnsEntries[0].DnsName]"The endpoint's DNS name, such as vpce-0123...us-east-1.vpce-svc-0123....vpce.amazonaws.com, resolves to the ENI addresses. Point your client at that name.
Common errors
| Symptom | Likely cause |
|---|---|
| Endpoint stays in `pendingAcceptance` | Provider has not accepted the request |
| Create call returns an authorization error | Your account is not in the service's allowed principals |
| Connection times out | The endpoint security group does not allow inbound traffic on the service port from your clients |
| Works from one zone only | Endpoint has no subnet in the client's zone, or the provider has no target in that zone |
Exercise
Your endpoint is available, but clients time out when connecting to the endpoint DNS name. Name the first thing to check.
Show answer
Check the security group attached to the endpoint. It must allow inbound traffic on the service's listener port from the clients. The provider's acceptance is already confirmed by the available state.