Skip to main content

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:

  1. 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.
  2. 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.
  3. The client-side app can poll to check the status of the job by using the job_id and the job-status endpoint.
  4. The step function runs several batch jobs that are highly optimized for specific processing tasks related to transcription of videos.
  5. The client-side app can get the results path using the get-results endpoint and passing the job id in the url args
  6. 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:

  1. Backend for handling image to pdf / pdf to image conversions as a service
  2. 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
  3. RAG pipeline for an AI powered app that provides idea validation as a service
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shared_constructs-1.0.6-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file shared_constructs-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for shared_constructs-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8bf43400c5f3f930be1b3335faa48a1775e3f805a16825ec849f3d64a6bc6d28
MD5 bbfd1a54e3b587dc0e0d45e7b9bfc22c
BLAKE2b-256 3cc57a7a222c89c8f44bbb0f0f1f27de4f3f8f84625fe8e80873f6444752334d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page