M.HMuhammad Hashir
  • Work
  • Principles
  • Experience
  • Contact
WorkCV ↓
← All work

Personal learning project

AI customer-inquiry routing

A serverless AWS system that answers customer questions with AI

RoleBuilt it to learn

Code ↗

Problem

Learning project: answer customer questions with AI without making customers wait.

Actions

  • Customers get an instant reply because receiving a question and answering it are separate steps.
  • Runs on a private network with no public exposure, reaching cloud services privately.
  • Everything is defined as code (Terraform), so the whole system can be rebuilt on demand.

Result

1 command

brings the whole system up or down

Architecture primary focus data outside
FORM · CLOUDFRONTAPI GATEWAYINGEST ΛRDS MYSQLSQSPROCESS ΛBEDROCKSES · SNS
FORM · CLOUDFRONTAPI GATEWAYINGEST ΛRDS MYSQLSQSPROCESS ΛBEDROCKSES · SNS

Details

A learning project: a web form for customer questions, an AI that drafts the answer, an alert to the right department and an email back to the customer. All serverless, all defined in Terraform.

The flow

The form is served from S3 through CloudFront and posts to API Gateway. An ingestion Lambda stores the customer and the question in MySQL and puts a message on SQS, so the customer gets an immediate response. A processing Lambda picks it up, asks a Claude model on Bedrock for a reply, alerts the department through SNS, emails the customer through SES and saves the answer.

The hard part

Functions that could reach the database but nothing else

To reach the database, the Lambdas run in private subnets, and then they couldn't reach SQS, SES or Bedrock. Instead of paying for a NAT gateway, private endpoints were added for each service. That still failed until DNS hostnames and DNS support were turned on for the VPC, so the SDKs resolved the private addresses, and every subnet was attached to the right route table.

One more: SQS kept delivering messages twice. The queue's visibility timeout has to be at least as long as the Lambda's timeout, or a message reappears while it's still being processed.

Stack, and why

  • Terraformevery resource as code
  • Lambda + SQSreceiving and answering handled separately
  • Bedrockthe drafted reply

Next case study

SymMark →