hands-on lab

Invoking Amazon Bedrock Models Using the Bedrock Runtime and AWS Lambda

Difficulty: Intermediate
Duration: Up to 1 hour and 15 minutes
Students: 119
Rating: 5/5
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.

Description

The Amazon Bedrock service includes a runtime that allows you to interact with the Amazon Titan models using APIs. The runtime is designed to be used with AWS Lambda functions, and it abstracts the complexity of invoking models, allowing you to focus on the model's input and output.

In this lab, you will deploy two AWS Lambda functions using AWS Serverless Application Model (AWS SAM) templates. Both functions will use the Amazon Bedrock runtime to interact with the Amazon Titan models. The first function will generate a text response using the Amazon Titan Text Model, and the second function will generate an image response using the Amazon Titan Image Generator Model.

The following AWS and AWS Community content was referenced to create this lab:

Learning objectives

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

  • Learn the prerequisites and limitations of the Amazon Bedrock runtime
  • Deploy a Lambda function that generates a text response using the Amazon Titan Text Model
  • Deploy a Lambda function that generates an image using the Amazon Titan Image Generator Model

Intended audience

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

Prerequisites

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

  • Amazon Bedrock
  • AWS Lambda
  • Amazon API Gateway
  • AWS Serverless Application Model (AWS SAM)

The following content can be used to fulfill the prerequisites:

Environment before

Environment after

Covered topics

Lab steps

Setting up the AWS SAM CLI
Invoking the AWS Titan Text Model Using AWS Lambda
Generating Images With the Amazon Titan Image Generator Model Using AWS Lambda