Aug 5, 2024
Image Moderation Using Node.js, Amazon Rekognition and SQS
Implement image moderation with Node.js, Amazon Rekognition, and SQS. This guide details setting up an automated system for content analysis and moderation.
Author


Book a call
Table of Contents
Ensure you’ve reviewed the prerequisites below and set up a functional working environment.
Prerequisites
- A working AWS account.
- Node.js:- I’ve used v20 LTS while writing this article.
- A working Node.js Express project (or any other framework of your choice) that at least has a working API for uploading the image to the storage bucket.
TL;DR

- Initialize the Node.js project with the required dependencies.
- Upload images to the S3 bucket.
- Send messages to the SQS queue to process the uploaded images.
- Retrieve messages from the queue and use Amazon Rekognition to analyze the images.
- Mark images as verified or blacklisted based on the analysis.
A Brief about AWS services used here
Amazon S3: S3 is cloud storage service that we’ll use to store the uploaded images. The benefit of using this is Amazon Rekognition can pick up the images from S3 directly using the S3 object key. You can also directly send the image byte data to Rekognition API if you use another storage provider.
Set up Services on the AWS Console
- AWS Credentials: Retrieve your access key and secret key. Go to Summary → Security Credentials to create them and download them.
- S3 Bucket: Follow these steps from the AWS documentation to create the bucket. If you want to display the images directly on our front end, you can set the permission to public, read-only. But we don’t need it for this article.
- SQS Queue: Follow these steps to create a standard queue.
TIP: To prevent unwanted cost, you can also simulate S3 and SQS on local system using tools like localstack, MinIO, and ElasticMQ to test the integration. For Amazon Rekognition, you can only test it with a live AWS account.
Let’s get started with Implementation:
- Install the following dependencies into your Node.js project.
2. Set the following environment variables in your project. Don’t change the key names of AWS variables because keeping the key name the same as below will allow AWS SDK to automatically pick up the correct credentials from the environment.
3. Create the aws services helper class in awsService.ts. This class creates and maintains the instance of different aws services used in the project.
new AwsService.SQS({ ..., endpoint: '<http://localhost>:SERVICE_PORT' })4. Create a route that uploads the image to the s3 service and queues the image for content moderation. An example snippet uses an express framwork. This does not include request validations and other sanity checks. Make sure to include them in the actual codebase.
- Create the consumer in your entry point i
ndex.tsfile. This will poll the queue and get the message we put in the above code snippet.
TIP 2: Be sure to check out the documentation at https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html to find out more request parameters and response values to suit your needs.
Conclusion
That’s it! We have demonstrated how to build a content moderation system using Node.js and AWS services. We can also extend this by setting up Custom Moderation Labels that can help enhance the accuracy, tailored more towards your project requirements. Thanks a lot for reading.
Subscribe to Our Newsletter
Subscribe to RSS
Press & Media Hub RSS FeedRelated Articles.
More from the engineering frontline.
Dive deep into our research and insights on design, development, and the impact of various trends to businesses.

Jun 27, 2026
Building a Resilient Hybrid-Cloud Network with WireGuard HA, Route-Based Failover, and Deep Observability

Jun 19, 2026
We Built a 114-Second AWS-to-Azure Failover. Here’s What We Learned

Jun 12, 2026
Cloud-Native and Cloud-Agnostic Are Not Ideologies; They Are Business-Stage Decisions

Jun 8, 2026
Geeklego: The Open-Source Design System Built to Work With AI

May 18, 2026
Your Vibe Code Has No Memory. DESIGN.md Fixes That.

May 14, 2026