How are you measuring the 500ms latency you are seeing?
DynamoDB is designed to provide consistent single-digit ms response time (i.e. < 10ms) for single-item GetItem and PutItem requests, and apart from occasional outliers, you should not expect to see anything higher.
That being said, it’s important to define what “response time” means. As I personally understand it, the “single digit ms response time” is the response time as measured from the time the DynamoDB service receives a request to the point at which the response is returned to the caller. Let’s call this the DynamoDB “server-side” time. If you look at DynamoDB latencies in CloudWatch, you are seeing server-side latencies.
This is *not* the same as round-trip time (RTT) latency. RTT includes the time it takes from for your client application to serialize the request, send the request over the network, the DynamoDB server-side time, the time to traverse the network back to the client app, and the time for the client app to deserialize the response. In your case, you also have to factor in overhead incurred from API Gateway (which should also be pretty low and visible in CloudWatch Metrics).
Looking at just the time it takes for your bits to travel over your network… the theoretical minimum between say a client app in say Seattle and in us-east-1 (Virginia) for the speed of light is say 30ms, and if you factor in all of the things in the physical network layer, you might be looking at say 100ms on top of the other things discussed above. Note - I am not a networking expert and basing these rough numbers off a quick Google search - not sure how accurate they are but they at least help conceptualize the point.
As mentioned above, you also have to factor in the client app’s serialization/deserialization times for request/response. You also have to consider exactly where in your Lambda code you are measuring request/response times. Are you measuring the 500ms as the time from when your Lambda starts to when it returns a result? or is the 500ms just the portion of the Lambda code that makes the request?
You might want to consider testing AWS X-Ray, a distributed tracing service, as this can help give you a detailed breakdown of where time is spent in your Lambda function and help you identify where optimization opportunities exist.
Also note, the “single-digit ms response times above” for server-side latency are for single-item get/puts from DynamoDB. If you are doing scans, queries, or other batch actions, it would be fair to expect an increase in latency that correlates to # of items that are written or # of items scanned.
One other thought - the programming language/version of your Lambda (or client app) could also have an impact. For example the blog post below performed a simple test that saw an approximate ~40% improvement in RTT latency simply by switching from Python 2x to 3x:
https://aws.amazon.com/blogs/database/analyzing-the-impact-of-python-version-on-amazon-dynamodb-scan-performance/