Frame 19229

Get Started with Amazon Bedrock and Run Your First AI Request

Posted by Nanda Larasati

August 27, 2026

How To Bedrock

Amazon Bedrock makes it possible to work with foundation models through APIs, allowing developers to integrate generative AI capabilities into their applications. This quickstart walks through the basic steps required to send your first inference request using Amazon Bedrock.
 

Step 1 — Prepare Your AWS Account

To get started, you need an AWS account. If you already have one, you can proceed directly to the next step.
 

Step 2 — Generate an API Key

Open Amazon Bedrock from the AWS Management Console and generate a short-term API key to authenticate your requests. For production applications, AWS recommends using IAM roles or temporary credentials instead.

 

Step 3 — Install the Required SDK

Install the SDK based on the API you plan to use: 

API  Required SDK 
Messages API  boto3 + anthropic 
Responses / Chat Completions API  boto3 + openai 
Invoke / Converse API  boto3 

Python must also be installed on your environment.

 

Step 4 — Configure Authentication

Set your API key as an environment variable based on the API you selected. 

For example: 

Message API:
AWS_BEARER_TOKEN_BEDROCK="<provide your Bedrock API key>"
ANTHROPIC_BASE_URL="https://bedrock-runtime.<your-region>.amazonaws.com/anthropic"

 

Responses / Chat Completions API:
OPENAI_API_KEY="<provide your Bedrock API key>"
OPENAI_BASE_URL="https://bedrock-runtime.<your-region>.amazonaws.com/openai/v1"

 

Invoke / Converse API:
AWS_BEARER_TOKEN_BEDROCK="<provide your Bedrock API key>"

 

Step 5 — Choose a Foundation Model

Next, choose the foundation model you want to use for your application. Amazon Bedrock supports 100+ foundation models, giving developers the flexibility to select a model based on their specific requirements.  

 

Messages API:
from anthropic import Anthropic
from aws_bedrock_token_generator import provide_token

token = provide_token(region="us-east-1")

client = Anthropic(api_key=token)

response = client.messages.create(
    model="global.anthropic.claude-opus-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Can you explain the features of Amazon Bedrock?"}]
)
print(response)

Responses API:
from openai import OpenAI

client = OpenAI()

response = client.responses.create(
    model="openai.gpt-5.6-sol",
    input="Can you explain the features of Amazon Bedrock?"
    )
print(response)

Chat Completions API:
from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model="openai.gpt-5.6-sol",
    messages=[{"role": "user", "content": "Can you explain the features of Amazon Bedrock?"}]
    )
print(response)

Converse API:
import boto3

client = boto3.client('bedrock-runtime', region_name='us-east-1')
response = client.converse(
    modelId='global.anthropic.claude-opus-5',
    messages=[
        {
            'role': 'user',
            'content': [{'text': 'Can you explain the features of Amazon Bedrock?'}]
        }
    ]
)
print(response)

Invoke API:
import json
import boto3

client = boto3.client('bedrock-runtime', region_name='us-east-1')
response = client.invoke_model(
    modelId='global.anthropic.claude-opus-5',
    body=json.dumps({
            'anthropic_version': 'bedrock-2023-05-31',
            'messages': [{ 'role': 'user', 'content': 'Can you explain the features of Amazon Bedrock?'}],
            'max_tokens': 1024
    })
 )
 print(json.loads(response['body'].read()))

Step 6 — Send Your First Inference Request

Amazon Bedrock supports several APIs for sending inference requests, including: 

  • Anthropic Messages API  
  • OpenAI Responses API  
  • OpenAI Chat Completions API  
  • Amazon Bedrock Converse API  
  • Amazon Bedrock Invoke API  

For example, using the Converse API, you can send a request to a selected model and provide a prompt such as: 

“Can you explain the features of Amazon Bedrock?” 

The response generated by the model can then be displayed in your application.  

 

Step 7 — Run Your Python Script

Save your Python code as:
bedrock-first-request.py 

Then run it using:
python3 bedrock-first-request.py

If the request is successful, you should see the inference output returned by Amazon Bedrock. 

 

Credit to: AWS Documentation

whatsapp icon.png
Start a Conversation

Privacy & Policy

PT Central Data Technology (“CDT” or “us”) is strongly committed to ensuring that your privacy is protected as utmost importance to us. https://centraldatatech.com/ , we shall govern your use of this website, including all pages within this website (collectively referred to herein below as this “Website”), we want to contribute to providing a safe and secure environment for visitors.

The following are terms of privacy policy (“Privacy Policy”) between you (“you” or “your”) and CDT. By accessing the website, you acknowledge that you have read, understood and agree to be bound by this Privacy Policy

Use of The Subscription Service by CDT and Our Customers

When you request information from CDT and supply information that personally identifies you or allows us to contact you, you agree to disclose that information with us. CDT may disclose such information for marketing, promotional and activity only for the purpose of CDT and the Website.

Collecting Information

You are free to explore the Website without providing any personal information about yourself. When you visit the Website or register for the subscription service, we provide some navigational information for you to fill out your personal information to access some content we offered.

CDT may collect your personal data such as your name, email address, company name, phone number and other information about yourself or your business. We are collecting your data in some ways, online and offline. CDT collects your data online using features of social media, email marketing, website, and cookies technology. We may collect your data offline in events like conference, gathering, workshop, etc. However, we will not use or disclose those informations with third party or send unsolicited email to any of the addresses we collect, without your express permission. We ensure that your personal identities will only be used in accordance with this Privacy Policy.

How CDT Use the Collected Information

CDT use the information that is collected only in compliance with this privacy policy. Customers who subscribe to our subscription services are obligated through our agreements with them to comply with this Privacy Policy.

In addition to the uses of your information, we may use your personal information to:

  • Improve your browsing experience by personalizing the websites and to improve the subscription services.
  • Send information about CDT.
  • Promote our services to you and share promotional and informational content with you in accordance with your communication preferences.
  • Send information to you regarding changes to our customers’ terms of service, Privacy Policy (including the cookie policy), or other legal agreements

Cookies Technology

Cookies are small pieces of data that the site transfers to the user’s computer hard drive when the user visits the website. Cookies can record your preferences when visiting a particular site and give the advantage of identifying the interest of our visitor for statistical analysis of our site. This information can enable us to improve the content, modifying and making our site more user friendly.

Cookies were used for some reasons such as technical reasons for our website to operate. Cookies also enable us to track and target the interest of our users to enhance the experience of our website and subscription service. This data is used to deliver customized content and promotions within the Helios to customers who have an interest on particular subjects.

You have the right to decide whether to accept or refuse cookies. You can edit your cookies preferences on browser setup. If you choose to refuse the cookies, you may still use our website though your access to some functionality and areas of our website may be restricted.

This Website may also display advertisements from third parties containing links to other websites of interest. Once you have used these links to leave our site, please note that we do not have any control over the website. CDT cannot be responsible for the protection and privacy of any information that you provide while visiting such websites and this Privacy Policy does not govern such websites.

Control Your Personal Data

CDT give control to you to manage your personal data. You can request access, correction, updates or deletion of your personal information. You may unsubscribe from our marketing activity by clicking unsubscribe us from the bottom of our email or contacting us directly to remove you from our subscription list.

We will keep your personal information accurate, and we allow you to correct or change your personal identifiable information through marketing@centraldatatech.com