Building Generative AI Apps on AWS with Terraform

Building Generative AI Apps on AWS with Terraform
Building Generative AI Apps on AWS with Terraform

CLOUD LABS



Building Generative AI Apps on AWS with Terraform

In this Cloud Lab, you’ll build and deploy generative AI apps on AWS with Terraform. Additionally, you’ll learn to manage automated, consistent infrastructure and leverage cloud-native AI solutions.

10 Tasks

intermediate

1hr 30m

Certificate of Completion

Desktop OnlyDevice is not compatible.
No Setup Required
Amazon Web Services

Learning Objectives

Hands on experience building generative AI applications using Terraform
The ability to create Bedrock Knowledge Bases with RDS vector store using Terraform
The ability to configure and attach a Bedrock Guardrail policy to filter unsafe or non-compliant content

Technologies
Terraform logoTerraform
Bedrock
API Gateway logoAPI Gateway
RDS
Lambda logoLambda
Cloud Lab Overview

Generative AI workflows often require coordinated provisioning of compute, storage, networking, and data services to support model ingestion and inference. Managing these resources manually can be error-prone and difficult to scale across environments. Terraform enables you to define and manage this infrastructure as code, ensuring consistency and repeatability.

In this Cloud Lab, you’ll deploy a cloud-native generative AI solution on AWS structured around two pipelines: document ingestion and question answering. You’ll begin by provisioning an Amazon S3 bucket to store source documents and an Amazon RDS database to store vector embeddings. You’ll then create an Amazon Bedrock Knowledge Base to index, manage, and query this data.

To automate updates, you’ll deploy an AWS Lambda function that synchronizes the Knowledge Base whenever new files are uploaded to the S3 bucket. You’ll also expose an Amazon API Gateway endpoint that generates presigned URLs, enabling secure uploads of documents. For the question-answering pipeline, you’ll deploy another Lambda function to process user queries against the Knowledge Base and integrate an Amazon Bedrock Guardrail policy to ensure safe and responsible responses.

The architecture diagram below shows the provisioned infrastructure you’ll build in this Cloud Lab.

Generative AI document ingestion and Q/A pipeline on AWS
Generative AI document ingestion and Q/A pipeline on AWS

Cloud Lab Tasks
1.Introduction
Getting Started
2.Set Up the Data Ingestion Pipeline
Create an S3 Bucket
Set Up an RDS Vector Database
Create the Bedrock KnowledgeBase
Create Lambda Functions
3.Build the Question/ Answering Feature
Set Up Guardrails
Create a Lambda Function to Q/A
Add an Endpoint to API Gateway
Test the Application
Conclusion
Labs Rules Apply
Stay within resource usage requirements.
Do not engage in cryptocurrency mining.
Do not engage in or encourage activity that is illegal.

Before you start...

Try these optional labs before starting this lab.

Relevant Courses

Use the following content to review prerequisites or explore specific concepts in detail.

Hear what others have to say
Join 1.4 million developers working at companies like