Create a service deployed on AWS Lambda that provides access to private S3 bucket files through pre-signed urls tracking usage based on token authentication.
- Application core: Python + FastAPI
- Package manager: Poetry
- Testing: Pytest + Moto
- Infrastructure management: Terraform
- Cloud services: AWS Lambda + DynamoDB + S3
- Setup package manager
- Install FastAPI
- Create dummy endpoint
- Setup S3 integration
- Create endpoint to list files
- Create endpoint to retrieve pre-signed url for a specific file
- Setup linting
- Setup testing
- Improve testing to use factory boy
- Improve testing by using moto to mock AWS services
- Setup persistence layer (DynamoDB?)
- Create endpoint to add new user
- Setup token auth to API
- Create usage measurements based on token auth
- Setup base terraform for managing resources
- Setup S3 resource (make it fully private to avoid public access)
- Setup DynamoDB resource
- Setup FastAPI deploy to AWS Lambda
- Adjust role to include S3 and DynamoDB permissions
- Setup CI/CD pipeline
- Setup pre-commit hooks
- Integrate project with localstack for easy local testing
- Improve code architecture by including service/repo layers
- Avoid local env from using real resources
- Include .env variables for deployed env
- Redirect loop happening on the deployed version of the app
For this project, a single-table approach was chosen to be used on DynamoDB, for this, listing the use-cases is very important.
- Check if user token exists (read)
- Register new user (write)
- Email must be unique across all users
- Register usage for each new request (write)
- Fetch usage based on token (read)