I added a VPC endpoint to my VPC using CloudFormation, and allowed s3 usage. The routes are visible in the AWS console, but not in the local routing tables of the EC2 instances:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0 UH    0      0        0 eth0 U     0      0        0 eth0

How do I verify that the EC2 instances in the VPC actually uses the VPC endpoint for S3, and not the available internet connection?

  • 1
    Just try accessing your s3 bucket from the instance – Arjun Prasad Dec 28 '16 at 10:52
  • @ArjunPrasad By accessing, I can confirm that S3 is available, not that it is available over the VPC endpoint – M. Glatki Dec 28 '16 at 10:55

I have found a method to verify the VPC endpoint usage.

  1. Log in to an AWS EC2 instance in the VPC
  2. Configure the aws cli client
  3. run aws ec2 describe-prefix-lists; for Windows PowerShell, Get-EC2PrefixList

The result should contain the the VPC endpoints prefix list ID in the attribute PrefixListId.

For additional verification, you can apply the following policy to an S3 bucket:

  "Version": "2008-10-17",
  "Statement": [
      "Effect": "Deny",
      "Principal": "*",
      "Action": [
      "Resource": [
      "Condition": {
        "StringNotEquals": {
          "aws:sourceVpc": [

with your vpc ID instead of vpc-121212. You should then only be able to access the S3 bucket from the given VPC


You can turn on S3 logging and check if the files are being accessed from your private IP rather than public. If your logging shows private IPs are accessing the buckets you've configured it correctly. Goodluck!


I would recommend to launch ec2 instance (with IAM role allowed to list s3 buckets) in subnet without internet access.

Basically only 2 active rules in route table (your VPC subnet range and s3 endpoint).

Connect to instance and run command:

aws s3 ls /**

It should fail with timeout because boto by default will create request to global s3 url (s3.amazonaws.com).

export AWS_DEFAULT_REGION=us-east-1** ## your region here
aws s3 ls /**

should list your buckets in us-east-1 region (vpc router will route your request to s3.us-east-1.amazonaws.com).


Your instance forwards packets destined to S3 to the local gateway, and from there the VPC 'router' forwards them to the S3 endpoint. No client configuration or knowledge is required.

You could configure the S3 endpoint with a very restrictive set of ACLs such that it denies all requests and observe your client receive the failure as well.

  • I suppose with ACL you mean SecurityGroups? I will try to add a limiting egress rule to the instance. – M. Glatki Dec 28 '16 at 19:13
  • 1
    @M.Glatki by ACL, I believe he means endpoint policy. – Michael - sqlbot Dec 28 '16 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.