AWS Serverless means building and running applications without managing servers. You don’t need to provision, scale, or maintain infrastructure. AWS handles that automatically while you focus on writing code and designing logic.
Resizing images is a common task, but managing servers to do it can be complex and expensive. With AWS serverless services, you can process images automatically without worrying about servers, scaling, or uptime.
I built a Serverless Image Resizer using AWS Lambda, S3, and SAM. It automatically resizes any image uploaded to an S3 bucket and saves the resized version to another bucket.
What the Project Does
When you upload an image to a source S3 bucket:
It triggers a Lambda function.
The Lambda downloads the image, resizes it to 300x300 pixels, and keeps the aspect ratio.
The resized image is uploaded to a destination S3 bucket.
The function supports JPEG, PNG, GIF, BMP, and TIFF image formats.
Why I Used Serverless
Serverless architecture is simple, cost-effective, and fully managed by AWS.
You don’t maintain any servers. AWS handles scaling, availability, and security patches automatically. You only pay when your Lambda function runs.
This approach makes it ideal for image processing workloads that don’t run continuously.
Tools and Technologies
AWS Lambda – runs the image resize code
Amazon S3 – stores source and resized images
AWS SAM – builds and deploys the application
Python (Pillow) – processes and resizes images
Amazon CloudWatch – monitors performance
SQS (DLQ) – stores failed image events
DynamoDB (optional) – stores metadata
How to Deploy
You can deploy it using AWS SAM:
1.Clone the repo
git clone https://github.com/Copubah/serverless-image-resizer.git
cd serverless-image-resizer
- Build the app
make build
- Deploy it
make deploy-guided
4.Upload a test image
make test-upload
After upload, the resized image appears in the destination bucket.
Monitoring and Reliability
The project includes:
CloudWatch alarms for errors and latency.
Dead Letter Queue (DLQ) for failed image events.
Encrypted S3 buckets and least privilege IAM roles for better security
You can find the full source code and setup guide here:
https://github.com/Copubah/serverless-image-resizer
Top comments (0)