javaamazon-web-servicesamazon-ec2amazon-dynamodbvpc-endpoint

How to verify that application in EC2 is using VPC endpoint to communicate with Dynamodb?


I have a Java application which is deployed in EC2 and communicate with Dynamodb. I have enable VPC endpoint (Gateway endpoint) for Dynamodb. But I didn't notice any performance improvement with this change. Theoretically I should see less latency via VPC endpoint compared to public access. Also based on the tcpdump, I can see our application is still using public IP of dynamodb to communicate. TCP Dump

Here 52.119.232.38 is dynamodb public IP. How can I verify that our application in EC2 is using VPC endpoint to communicate with Dynamodb ?


Solution

  • You can use AWS cloudtrail to verify this. If you only connect to DynamoDB from the application hosted on AWS network which has the associated VPC Gateway Endpoint, then you should only see private IPs in the Source IP field in the Cloudtrail logs. If you see other public IPs, then it means the DyanmoDB is being accessed over the internet.

    If the source ip is not a private IP of the EC2 instance, ensure the applicable route tables are updated with the gateway endpoint entry by following the To add or remove route tables used by a gateway endpoint section of the link here