Is Using AWS Lambda for Image Processing a Smart Move for My EC2 App?
Asked by
2uL_aliquot
I'm developing a Node.js marketplace application for buying and selling items, and my backend is hosted on EC2. I need to manage tasks like resizing images, adding watermarks, and performing NSFW checks. Since image processing tasks can take some time and users won't mind waiting for their ads to publish, I'm considering using AWS Lambda for offloading just the image processing part. This would be triggered through S3 or SQS, while keeping the rest of my API on EC2. I'd like to know if this is a common and sensible approach, or if it's introducing unnecessary complexity when compared to using EC2 workers. Cost is a major concern for me right now, rather than speed. Additionally, I'd appreciate any advice or alternatives for setting up this kind of system.
Answers
Microservices are the way to go! Just pick whatever works best for you now and be flexible for future changes. I often mix different resources depending on what fits my needs.
Reply to this answer
Have you considered using Cloudflare Images? It's perfect for all the tasks you mentioned and even has a generous free plan. Running sharp on Lambda might not be the most efficient choice.
Reply to this answer
I think you'll find that using Lambda could end up being more expensive than sticking with small reserved instances or Docker containers on EC2. Itโs usually more cost-effective in the long run.
Reply to this answer
Image processing is definitely one of the ideal cases for using Lambda! It can scale well with your workload and youโll find plenty of guides online to help you set everything up.
Reply to this answer
I suggest breaking each check into its own Lambda function and orchestrating them with a Step Function. That way, you'll have clear insights on cost per function, helping you track anomalies effectively.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions