Sentiment Analysis using AWS Comprehend & Lambda

Design a serverless sentiment analysis system leveraging AWS services. Requirement Gather the input text (that could be a comment or a feedback on a survey, etc) and feed it into a compute service that figures out the sentiment from the text & saves it into a database. Glossary SQS: It is a managed message queuing service that lets enables us to decouple and scale serverless applications by sending, storing, and receiving messages. Lambda: It is a serverless compute service that allows us to run code without managing servers and worrying about scaling. Comprehend: It is an NLP service that helps us extract key phrases, sentiment, PII, syntax, entities, identify language, and more. RDS: It is a managed relational DB service that simplifies setting up, operating & scaling relational databases on cloud (AWS). Design Solution Implementation Plan An SQS queue that stores messages and triggers Lambda function. The Lambda function processes the message body and invokes Comprehend to infer the sentiment from the text. Finally the Lambda function stores the text and inferred sentiment into a table in RDS. RDS table schema Follow me on my socials Linkedin: https://www.linkedin.com/in/anmol-pal/ Github: https://github.com/anmol111pal Twitter/X: https://x.com/anmol111pal

Apr 5, 2025 - 08:57
 0
Sentiment Analysis using AWS Comprehend & Lambda

Design a serverless sentiment analysis system leveraging AWS services.

Requirement

Gather the input text (that could be a comment or a feedback on a survey, etc) and feed it into a compute service that figures out the sentiment from the text & saves it into a database.

Glossary

SQS: It is a managed message queuing service that lets enables us to decouple and scale serverless applications by sending, storing, and receiving messages.

Lambda: It is a serverless compute service that allows us to run code without managing servers and worrying about scaling.

Comprehend: It is an NLP service that helps us extract key phrases, sentiment, PII, syntax, entities, identify language, and more.

RDS: It is a managed relational DB service that simplifies setting up, operating & scaling relational databases on cloud (AWS).

Design Solution

Image description

Implementation Plan

  • An SQS queue that stores messages and triggers Lambda function.

  • The Lambda function processes the message body and invokes Comprehend to infer the sentiment from the text.

  • Finally the Lambda function stores the text and inferred sentiment into a table in RDS.

RDS table schema

Image description

Follow me on my socials

Linkedin: https://www.linkedin.com/in/anmol-pal/

Github: https://github.com/anmol111pal

Twitter/X: https://x.com/anmol111pal