Get startedGet started for free

Accessing Amazon Bedrock

1. Accessing Amazon Bedrock

Hello! Welcome to this course.

2. Meet your instructor!

I'm Nikhil, a Machine Learning Engineer with experience in AWS, Azure, and software development. My background in Data, Cloud, and Computer Engineering gives me a broad perspective on AI solutions.

3. What is Amazon Bedrock?

Amazon Bedrock is a service from AWS that lets us use AI models without building or downloading them.

4. What is Amazon Bedrock?

It works through an API, which is like a messenger that lets different software systems talk to each other. With Bedrock, we can access AI models from Anthropic, Meta, and other providers on a secure platform. No setup or training is needed; we pay only for what we use.

5. Foundation models in Generative AI

Bedrock enables access to foundation models, which are pre-trained AI models for tasks like generating text, code, or images. It offers several specialized models: Claude and Jurassic for text, Stable Diffusion for images, and Titan for embeddings.

6. Understanding access to Amazon Bedrock

In this course, we'll use pre-generated credentials to interact with Bedrock's AI models. So, we don't need to worry about setting up our own credentials for the exercises. However, when using Bedrock outside of this course, we'll need to set up access. First, we'll create a user entity in our AWS Console, also known as an IAM user. Then, we'll need to attach the AmazonBedrockFullAccess permission - this grants us the ability to use all Bedrock features. Finally, we'll get our access credentials - AWS region, for instance US East 1, Access Key ID and Secret Access Key. We'll need these to authenticate our API calls.

7. Setting up Bedrock runtime access

Let's look at how to set up Bedrock to access models in Python. First, we configure AWS credentials by defining the region, access key, and secret key. While we're showing these directly here, we'd use more secure methods in a production environment. Next, we initialize the Bedrock client using boto3, the library allowing access to AWS services in Python. A Bedrock client is the connection point to the AWS Bedrock service, enabling API calls to the AI models. Notice that here, we add 'runtime' when defining the client, which is the option that allows to run model inference. Finally, we'll need to enable Bedrock models in the AWS Console, covered in the next video. For this course, models are already enabled, and credentials are preset, so they won't be needed for the exercises.

8. Setting up Bedrock access

For operational requests like listing models, we initialize the client using 'bedrock' - without the 'runtime'. Here, for example, we use list_foundation_models, a helpful check to verify our environment is properly configured before making requests.

9. Information on foundation models

Before moving forward, let's retrieve some information about the models we'll be using, with the .get_foundation_model() method. It needs to be supplied with a model ID: a unique identifier representing a model available in Bedrock. For our course, we'll use the Amazon Nova and the Anthropic Claude models.

10. Information on foundation models

Here's what we get when we call get_foundation_model() for Claude. The response includes essential details about the model, such as the name, the provider, and an identification code. It also contains some technical specifications, such as input/output modalities and streaming support. This information helps us understand the model's capabilities before using it.

11. Let's practice!

Let's get ready to start invoking Bedrock via the API!