Skip to main content

Compare Methods to Access Amazon Bedrock

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe how to access Amazon Bedrock in the AWS Management console.
  • Explain the purpose of programmatic interaction with Amazon Bedrock through an API.
  • Differentiate between the two methods of accessing Amazon Bedrock foundation models.

How to Access Amazon Bedrock?

You can interact with Amazon Bedrock’s foundation models in two ways: through the AWS Management console and programmatically with the API. Both methods require that you do the following before you can use Amazon Bedrock.

  • Activate an AWS account.
  • Configure the correct permissions in AWS Identity and Access Management for Amazon Bedrock.
  • Request access to the foundation models (FMs) you want to use.
  • Ensure you’re working in the AWS Region where Amazon Bedrock is available.

For more information about the prerequisites, see Getting started with Amazon Bedrock in the Amazon Bedrock User Guide.

Let’s look at each method in more detail.

Get Started with Amazon Bedrock in the AWS Management Console

The AWS Management console provides a visual, interactive environment for experimentation and learning. The console features several playgrounds for text, chat, and image generation. In the text or image playground, you can experiment with prompts and immediately review the results. In the chat playground, you can interact with the FM of your choice by using a conversational interface.

The following architecture diagram shows how users interact with Amazon Bedrock playgrounds on the console.

Diagram showing requests and responses going back and forth between Users or Consumers and Amazon Bedrock; queries and responses go between the Amazon Bedrock console and playgrounds for chat (Amazon Titan FM), text (Amazon Titan FM), and images (Stable Diffusion FM) before sending responses back to Users or Consumers.

In ‌playgrounds, you provide a prompt, which is a natural language command to receive an answer or response. To make the response more factual or creative, you can also adjust inference configurations, such as temperature and top P. Amazon Bedrock also includes capabilities for model assessment, integration with knowledge bases, task automation, safeguards, model deployment, and more. You’ll further explore inference parameters and Bedrock’s capabilities in the module Amazon Bedrock Foundation Models.

For step-by-step instructions on how to access Amazon Bedrock through the Management console, see Getting started in the Amazon Bedrock console.

Get Started with Amazon Bedrock Programmatically

Though the Amazon Bedrock console is great for testing and experimenting, the API offers benefits for production deployments. With programmatic access, you can manage models, update configurations, and complete model evaluations. This can improve efficiency, reduce manual effort, and help maintain consistent access to your deployments.

There are a few options for interacting with the Bedrock API programmatically.

  • AWS Command Line Interface (AWS CLI): The AWS CLI is a unified tool that provides a simple way to interact with various AWS services, including Amazon Bedrock. The CLI is particularly useful for automating repetitive tasks or integrating Bedrock into broader infrastructure management workflows.
  • AWS Software Development Kit (AWS SDK): AWS SDKs are available for popular programming languages, including Python, Java, and Node.js. Each SDK provides an API, code examples, and documentation to help you build applications in your preferred language.
  • Amazon SageMaker AI Notebooks: If you’re working in a Jupyter Notebook environment, you can use the built-in AWS SDK integration to interact with the Bedrock API directly from your notebook. This can be useful for prototyping, testing, and developing models that use Bedrock.

To use any of these options, you first need to obtain API credentials, including an access key and a secret. You also need to install the AWS CLI or the appropriate SDK for your programming language. After you have your credentials and the necessary tools installed, you can start making requests to the Bedrock API.

For step-by-step instructions to access Amazon Bedrock programmatically, see Getting started with the API in the Amazon Bedrock User Guide.

Wrap Up

In this unit, you learned about two methods to access Amazon Bedrock: through the console and through the AWS API. Most organizations can benefit from both access methods. You can often start in the console to understand model configurations and behavior. Then, you can use the Bedrock API to incorporate the model into your broader application architecture and automate many common tasks. In the next unit, you explore the cost structure of Amazon Bedrock and assess various pricing models for a specific use case.

Resources

Comparta sus comentarios de Trailhead en la Ayuda de Salesforce.

Nos encantaría saber más sobre su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios en cualquier momento en el sitio de Ayuda de Salesforce.

Más información Continuar a Compartir comentarios