
Building AI-powered workflows with AWS (with Bedrock and SES)
Using AI to solve product problems - such as a manual email workflow - with AWS SES, S3, Bedrock, Secrets Manager, and Lambda.
Recently I was asked by my product manager, "How can we use AI to solve XXX problem?" (If you're curious on the final solution, scroll to the end of this article.)
That got me thinking. We know for a fact that we want to rely on AI to solve everyday problems. But with examples pushing for chatbots and AI agents — both of which are the simplest and complex methods respectively — is there no middle ground for using AI in existing workflows?
Hence, I'm here today to explore this topic. How do we solve problems using AI more intuitively, even if we don't build chatbots or AI agents?
The Problem Statement
Onto my problem statement — I have several workflows with clients that rely on manual email communication. How can I intelligently transform these manual email inputs into triggers for coded tasks - thus creating much needed "automation" here?
In the following chapters, we'll be solving this problem in parts:
- First, we'll understand how to receive emails with AWS.
- Second, we'll look at how we can process these emails within AWS with AI, and use them to trigger coded tasks.
- Lastly, we'll touch on how we can structure our app's design to make it easily extendable.
The Input Layer — SES for receiving emails

AWS Simple Email Service (SES) is best known for a simple email integration at a highly competitive pricing point. But did you know that SES could be used to receive emails too? 😱
Ingesting emails with AWS — SES, S3, and Lambda
In theory, this means that we could use SES to receive emails, and use it to invoke a Lambda function for each received email. The Lambda function can then either do the processing work directly, or redirect to the appropriate workers. Automation problem solved, right? Alas this is not the case, as the triggered Lambda event from SES will not contain the much needed email body for processing 🥲

The proper solution is to make use of S3 instead. Here we look at creating a rule with the receipt action to save to S3, then make use of event notifications from S3 to trigger Lambda. This way, we get to retain the full payload of our received emails for processing 👍


For a detailed guide to process emails via SES and save to S3, see here . You can then implement the trigger from S3 to Lambda with this guide .
Before moving on from SES, make sure you set up the domain for receiving emails on SES. This requires you to publish the AWS provisioned CNAME and TXT records within your domain's config from your domain registrar. You'll also need to set up an MX record, more detailed steps can be found here .

If done correctly and validated, SES will notify you via email that your setup has succeeded 🎉

The AI Layer — Processing with Bedrock
Now that we've figured out a way to redirect emails to Lambda, let's solve the “how” for processing these emails!
The challenging part is the unstructured "input" here — being manually composed emails. This makes it impossible to parse it deterministically with scripted logic. How about trying to solve it with AI?
We can turn to AWS Bedrock, a fully managed AWS service that lets you build AI-powered applications from AWS provided SDKs. This is done using popular AI foundation models, such as those found below:

When referring to using AI, most people today will think about chat-like responses that are usually unstructured. In order to "tame the chaos", we will need to make use of a new feature of Bedrock — "Structured outputs". Released in Feb 2026 , Structured outputs allows select foundational models in Bedrock to deliver an intended JSON schema more reliably:


Prior to the introduction of Structured outputs, function calling was the de facto method for achieving this. With this Structured outputs feature, the generated output becomes more dependable — and this same reliability can be layered onto function calling itself, ensuring responses stay aligned with external data sources.
Let’s complete the implementation of Bedrock within Lambda, making use of the converse method with Boto3 (running Lambda with Python). We also define a well-crafted system instruction informing on the intended structure, while using the defined output schema within
outputConfig as seen below:
If done correctly, you should see Bedrock reliably passing the structured response back within Lambda’s control for further processing, but this time with well-structured values 😉 . This makes it easy to wire the values to be used elsewhere, such as being used to create chat notifications, or creating a ticket to triage on task management systems 😮

Piecing everything together — Design patterns and Infrastructure
With that, we put together our existing progress so far, and we should get the following:

The above works — but configuring it manually is going to be a huge chore. Hence, we turn to Terraform, which embodies the “Infrastructure as Code (IaC)” concept, allowing the entire stack above to be deployed using just a few CLI commands:


Note that this Terraform config was built to be easily extended upon. It is designed as a standalone module , grouping together SES, S3, Bedrock, Secrets Manager, and of course our Lambda app to be deployed in one fell swoop. Simply copy the module and paste within your codebase, making changes if necessary. Note that you’ll still need to configure the MX, CNAME, and TXT records with your domain registrar separately.
I also want to make sure that the coded Lambda application can be easily understood and also easily extendable upon in the future (adding more processing steps and output destinations as needed), so I’ve structured our code as follows:

With that we’ve refactored our application to use Terraform and made its structure better. See the end result here or if you want to replicate it for your own use — https://github.com/Weiyuan-Lane/step-lambda/tree/main
Summary
We’ve achieved our goal 🥳! We’ve managed to create an AI-powered workflow in AWS, receiving emails and creating a productive output from unstructured manual emails from different people. We also did this from a combination of AWS tooling — SES, S3, Bedrock, Secrets Manager, and Lambda (plus CloudWatch logging and monitoring) — a good combination of utility to serve what we need to achieve our goal.

With this, it shows clearly that you don't necessarily need to resort to AI agents or chatbots to solve for every product problem. A middle-ground can be reached by using Bedrock and structured outputs, and more advanced use cases can tap on function calling, and even drive deeper context discovery with MCP and A2A servers, and more!
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article