AWS Solutions Architecture
Project description
awesome-aws
This repository contains a generic solution which uses a combination of api gateway + s3 + lambda + batch + dynamodb for large-scale async workloads.
The key architectural challenges addressed by the solution are:
- api gateway has a hard limit of 10Mb file size in POST requests. To get around this, I setup a lambda that generates a pre-signed url that is used to grant the client app to upload directly to s3, which can handle terabyte size files.
- Processing large files for inference is best handled async. I created an API gateway endpoint that takes the user_id and object name in the url args and then a lambda is triggerred whenever this endpoint is called. The lambda parses the user_id and object name and generates a job id and triggers a step function. The step function ARN and job_id are stored in dynamodb. The job_id is returned in the response.
- The client-side app can poll to check the status of the job by using the job_id and the job-status endpoint.
- The step function runs several batch jobs that are highly optimized for specific processing tasks related to transcription of videos.
- The client-side app can get the results path using the get-results endpoint and passing the job id in the url args
- The completed job metadata is tracked in dynamodb
Overall, this solution is low-cost, efficient, scalable, and generic enough to be applicable to hundreds of use cases.
Some examples of use cases:
- Backend for handling image to pdf / pdf to image conversions as a service
- Process a video feed to collect all the faces that appear in the video and then compare the faces with a specified face picture to determine if the person is in the video
- RAG pipeline for an AI powered app that provides idea validation as a service
- Application to analyze images/videos/audio for deep fake detection
structure
common_code: this folder contains the code for the shared_constructs package which is installed into docker images, and added as a lambda layer, to allow code reusability. I found publishing a package to pypi to be the easiest way to share code throught different pieces of the solution.
lambda-batch-s3-solution: the solution code. batch contains the code and other files for aws batch jobs. lambdas contains the code for lambda functions used.
Next Steps
I will probably work on additional solution architectures that serve as a generic solution that can fulfill many use cases.
Perhaps I'll create a generic solution for "real-time" processing tasks.
Or maybe a generic solution for data ingress and egress.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters