hands-on lab

Embedding Documents With LangChain and Amazon Bedrock

Up to 1h
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.
Lab description

Embeddings are used in Generative AI to represent high-dimensional data in a lower-dimensional space. They are numerical representations, or vectors, of data that capture the relationships between data points. AI models can use these mathematical representations to generate new data points similar to the original data. Embeddings are crucial for implementing a Retrieval-Augmented Generation (RAG) model, which combines generative AI models with retrieval models to improve the quality of generated data.

LangChain is a framework for developing Large Language Model (LLM) applications. The LangChain framework provides various integrations for embedding models, including Amazon Bedrock.

In this lab, you will learn how to create a PDF document embedding application using the LangChain framework and deploy it using AWS Serverless Application Model (SAM).

Learning objectives

Upon completion of this intermediate-level lab, you will be able to:

  • Utilize the LangChain framework to create a PDF document embedding application
  • Deploy the embedding application and its resources using AWS SAM

Intended audience

  • Candidates for the AWS Certified Machine Learning Specialty certification
  • Cloud Architects
  • Software Engineers


Familiarity with the following will be beneficial but is not required:

  • Amazon Bedrock
  • AWS Lambda
  • Amazon Simple Storage Service (S3)
  • Amazon Simple Queue Service (SQS)
  • AWS Serverless Application Model (SAM)

The following content can be used to fulfill the prerequisites:

Environment before

Environment after

About the author
Jun Fritz, opens in a new tab
Cloud Labs Developer
Learning paths

Jun is a Cloud Labs Developer with previous experience as a Software Engineer and Cloud Developer. He holds the AWS Certified Solutions Architect and DevOps Engineer Professional certifications. He also holds the AWS Certified Solutions Architect, Developer, and SysOps Administrator Associate certifications. 

Jun is focused on giving back to the growing cloud community by sharing his knowledge and experience with students and creating engaging content. 

Covered topics
Lab steps
Logging In to the Amazon Web Services Console
Setting up the AWS SAM CLI
Reviewing the Embedding Solution
Working With LangChain and Amazon Bedrock in AWS Lambda
Generating PDF Document Embeddings