This repository contains terraform infrastructure code that implements a serverless image processing system.
This codebase contains both the source and infrastructure code that are necessary for the system.
Serverless is a cloud execution model where you write and deploy code without managing servers. The cloud provider automatically handles:
-
Infrastructure provisioning
-
Scaling up/down
-
High availability
-
Patch management
AWS Serverless Technology is used in this project. For a deeper dive please feel free to read this article.
The following are the components used in this project:
- Amazon S3: Amazon Simple Storage Service (Amazon S3) is an object storage service offering industry-leading scalability, data availability, security, and performance.
- AWS Lambda: AWS Lambda is a compute service that runs your code in response to events and automatically manages the compute resources.
- Amazon CloudWatch: CloudWatch is an intelligent observability service that provides actionable insights across applications and infrastructure.
- Amazon DynamoDB: DynamoDB is a serverless, fully managed database that instantly scales to fit your applications' needs with zero infrastructure management, zero downtime maintenance, and zero maintenance windows.
- AWS IAM: AWS Identity and Access Management (IAM) is a globally scoped AWS service that enables organizations to securely define, manage, and enforce fine-grained permissions for identities and resources, ensuring that the right principals have the appropriate level of access to AWS services and assets.
- Amazon SNS: Amazon Simple Notification Service (SNS) is a fully managed, highly scalable publishโsubscribe messaging service that enables the decoupled, asynchronous delivery of messages and event notifications to multiple subscribers across distributed systems and applications.
Below is the chain of events that occur in this architecture:
- User uploads image to Source S3 Bucket
- AWS Lambda Function gets triggered
- AWS Lambda Function runs image processing code
- CloudWatch monitors and collects logs from AWS Lambda Function
- AWS Lambda Function persists processed image to Destination S3 Bucket
- AWS Lambda Function persists metadata to DynamoDB Table
- AWS Lambda Function sends message to SNS Topic
- SNS Topic sends email to designated/provided email address
The following are pre-requistes that are necessary to successfully use this package and deploy the desired infrastructure:
This project requires the user to specify an email address using terraform.tfvars file. Please follow the steps below:
- Create a file named terraform.tfvars file in the root directory
- Add
email_endpoint="YOUR_EMAIL_ADDRESS"and save the file
This project utlisies a Makefile for convinience and ease of development. The following are the commands that are pertinent to this project:
make init
Initializes the project
make run
Updates lambda source code
make plan
Displays planned changes
make deploy
Deploys desired infrastructure
make destroy
Removes deployed infrastructure
This project is a great base for further development. Some ideas for extending/building upon this project:
๐ Web & mobile apps
-
Profile photo resizing
-
Product image optimization
-
User-generated content pipelines
๐ E-commerce
-
Dynamic product thumbnails
-
Watermarking
-
CDN-ready assets
๐ธ Media & SaaS platforms
-
Photo moderation
-
AI-based tagging
-
Searchable image libraries
๐ Enterprise & compliance
-
Document image processing
-
Redaction & OCR
-
Audit-ready pipelines
Users are more than welcome to fork this repository and build upon it, however, do keep in mind the following: LICENSE
Likewise contributions to this repository are welcome as well but the intention is to keep this repository as a base serverless image processing system. Fully fledged products/systems should be in different repositories that have been forked from this one.
โโโCHEERS AND THANK YOUโโโ
