I'm designing a photo sharing app (location based). I plan to use AWS Cognito for authentication/authorization, DynamoDB for persistent data, S3 for file storage, and Lambda + API Gateway for web services.
These are the key use-cases/access patterns (other than sign-up/sign-in):
- User creates a post: title, media, location (lat,lon)
- Users fetch a list of posts closest to their geo-location (newest first)
These are the Tables that I'm going to create:
Users table
hash-key=userID from cognito
Posts table
hash-key=userID from cognito
range-key=date
other-attributes=title, image-s3-path, ge-location
What is the best way to implement a query (perhaps with the help of adding LSI, GSI, or even more tables), so that the result is a collection of posts based on users's current location. Eg. show only posts within 10 km of radius, sorted by newest first.