You need three things before you start: an AWS account, Python 3 on your machine, and about 30 minutes.
That’s enough to learn how to use Amazon Bedrock properly: pick a model, call it from code, add a safety filter and point it at your own documents.
If you’re still deciding whether Bedrock is the right service at all, read what Amazon Bedrock is first. This guide assumes you’ve picked it and want something working today.
Last checked against the AWS docs on December 2, 2026.
Before you start: an AWS account; the AWS CLI installed and signed in (optional); Python 3 with pip; and a billing alert, since every call is billed per token.
This post contains affiliate links. As an Amazon Associate, Stepstocloud.com earns from qualifying purchases.
The Bedrock docs show you which buttons to press. Chip Huyen’s AI Engineering covers what the buttons can’t: prompt design, evaluation and when retrieval beats a bigger model.

Step 1: Pick a Region and a model
Open the Bedrock console and switch to the Region you’ll build in. US East (N. Virginia) us-east-1 and US West (Oregon) us-west-2 get new models first.
London is eu-west-2 and Canada Central is ca-central-1 if data has to stay closer to home.
Then open the model catalog and copy a model ID.
Many IDs start with a prefix such as global., us. or eu.. That prefix is an inference profile: it lets Bedrock route the request to another Region inside that area when one is busy.
Pick us. or eu. when your data must stay in one geography; global. gives the most capacity.
This guide uses the ID from the AWS quickstart, global.anthropic.claude-opus-5. For cheap first tests, a smaller model from the same catalog works the same way.
Step 2: Test the prompt in the console playground
Before writing code, go to Playgrounds > Chat in the Bedrock console, choose the model and paste the prompt your app will send. It’s the fastest way to see whether the model handles your task at all.
Tweak the system prompt and the maximum output length here, not in code. When the answers look right, write down those settings; you’ll pass the same values in Step 4.
The first call to a third-party model also starts its AWS Marketplace subscription in the background, so testing in the playground first clears that step before your code runs.
Step 3: Give your code permission
Your code needs an identity allowed to call Bedrock. You have two choices, and the right one depends on where the code runs.

| Option | Use it for | How long it lasts |
|---|---|---|
| IAM role or your CLI sign-in | Apps on AWS (Lambda, ECS, EC2) and your laptop via your CLI profile | Temporary credentials that renew automatically |
| Short-term Bedrock API key | Quick tests and OpenAI-style SDKs | Up to 12 hours, one Region only |
| Long-term Bedrock API key | Exploration only | Until the expiry you set; creates an IAM user |
For an IAM role or user, AWS publishes managed policies. AmazonBedrockLimitedAccess covers calling models plus the Marketplace subscriptions third-party models need, without full admin rights. See our IAM basics if roles and policies are new to you.
For a quick test, generate a key under API keys > Short-term API keys in the console. The short-term key lasts up to 12 hours and works only in the Region where you made it.

Short-term keys behave much like the temporary credentials from AWS STS: nothing to rotate, and a leaked key dies on its own.
Step 4: Send your first request from Python
Install or upgrade the AWS SDK for Python. If you use an API key, set it as an environment variable; if you’re signed in with the CLI, skip that line.
pip install --upgrade boto3
# Only when using a Bedrock API key (macOS/Linux)
export AWS_BEARER_TOKEN_BEDROCK="paste-your-short-term-key"
# Windows PowerShell
$env:AWS_BEARER_TOKEN_BEDROCK="paste-your-short-term-key"
Now save this as first_app.py. It uses the Converse API, which works the same way across every Bedrock model that supports messages, so switching models later means changing one string.
import boto3
MODEL = "global.anthropic.claude-opus-5"
client = boto3.client("bedrock-runtime", region_name="us-east-1")
response = client.converse(
modelId=MODEL,
system=[{"text": "You are a support assistant. Answer in three sentences or fewer."}],
messages=[{"role": "user", "content": [{"text": "How do I reset my password?"}]}],
inferenceConfig={"maxTokens": 300, "temperature": 0.3},
)
print(response["output"]["message"]["content"][0]["text"])
print(response["usage"]) # inputTokens and outputTokens: what you pay forRun python first_app.py. You’ll see the answer and a usage line with input and output token counts. Keep an eye on that line: it’s your bill, one request at a time.
The maxTokens value is your cost ceiling for each answer. Set it on every call, not just in the playground.
Step 5: Stream the answer for a chat feel
Users don’t want to stare at a spinner. converse_stream sends the answer as it’s written, so text appears word by word:
stream = client.converse_stream(
modelId=MODEL,
messages=[{"role": "user", "content": [{"text": "Write a two-line welcome message."}]}],
inferenceConfig={"maxTokens": 200},
)
for event in stream["stream"]:
if "contentBlockDelta" in event:
print(event["contentBlockDelta"]["delta"]["text"], end="", flush=True)For a multi-turn chat, keep appending each user message and each assistant reply to the messages list. The model has no memory between calls; the list is the memory, and every token in it is billed again on each turn.
Step 6: Add a guardrail
A guardrail filters what users send and what the model says back. Create one under Guardrails > Create guardrail: add content filters, denied topics and sensitive-information rules, then publish a version.

Then pass its ID and version on each call:
response = client.converse(
modelId=MODEL,
messages=[{"role": "user", "content": [{"text": user_text}]}],
guardrailConfig={"guardrailIdentifier": "your-guardrail-id", "guardrailVersion": "1"},
)
if response["stopReason"] == "guardrail_intervened":
print("Blocked by the guardrail")One gap worth knowing: when your app uses tools (function calling), the guardrail doesn’t evaluate tool inputs or tool results. Validate those in your own code.
Step 7: Answer questions from your own documents
To make the model answer from your manuals or policies, use a Knowledge Base. Put the files in an Amazon S3 bucket, then choose Knowledge Bases > Create > Knowledge base with vector store.

Let Bedrock quick-create the vector store. The quick-create options are OpenSearch Serverless, Aurora PostgreSQL Serverless, Neptune Analytics and Amazon S3 Vectors. S3 Vectors has no always-on cluster to pay for, which suits a small project.
Click Sync on the data source after every file change, then ask questions from code:
kb = boto3.client("bedrock-agent-runtime", region_name="us-east-1")
answer = kb.retrieve_and_generate(
input={"text": "What is our refund window?"},
retrieveAndGenerateConfiguration={
"type": "KNOWLEDGE_BASE",
"knowledgeBaseConfiguration": {
"knowledgeBaseId": "your-kb-id",
"modelArn": "model-or-inference-profile-ARN-from-the-console",
},
},
)
print(answer["output"]["text"])
for cite in answer["citations"]:
print(cite["retrievedReferences"][0]["location"])The citations tell you which file each answer came from. Show them to users; it’s the easiest way to build trust in the answers and to spot a stale document.
Bedrock’s model invocation logging is off by default. Turn it on under Settings and send logs to CloudWatch Logs or S3, so you can see every prompt, answer and token count when something looks wrong.
Then set an AWS billing alert at an amount you’d be annoyed to lose. A demo link shared in a team chat can run thousands of calls overnight.
Fix the errors you’ll probably hit
| Error or symptom | Likely cause | Fix |
|---|---|---|
| Unable to locate credentials | boto3 older than 1.39.0, or no sign-in | Upgrade boto3, or sign in with the AWS CLI first |
| AccessDeniedException | Policy lacks Bedrock or Marketplace actions | Attach AmazonBedrockLimitedAccess, wait a minute, retry |
| On-demand throughput isn’t supported | Model needs an inference profile ID | Use the ID with the us., eu. or global. prefix |
| ThrottlingException | Too many requests per minute | Retry with backoff, or use a global. profile |
| API key stops working | Short-term key expired or wrong Region | Generate a new key in the same Region as the client |
| Knowledge base answers miss new files | Data source not synced | Run Sync after every upload |
Once this works, the next steps are agents and tools. Our AWS generative AI tools guide shows which service handles what, and Bedrock AgentCore is where AWS now runs agents.

Books for building AI apps

AI Engineering (Chip Huyen)
Prompting, RAG, evaluation and agents explained for people building on foundation models.
Check price on Amazon
Hands-On Large Language Models
Visual explanations of embeddings and retrieval, the ideas behind Step 7’s knowledge base.
Check price on AmazonFrequently asked questions
Is Amazon Bedrock free to use?
There is no charge to turn Bedrock on, but every model call is billed, usually per input and output token at that model’s own rate. Knowledge bases add vector store and storage costs, and guardrails are billed per text unit checked. Set a billing alert before you start testing.
Do I need to request model access in Amazon Bedrock?
Usually not any more. Most models are available by default, and the first call to a third-party model starts its AWS Marketplace subscription automatically. Your IAM identity needs the Marketplace subscribe permissions, which the AmazonBedrockLimitedAccess managed policy includes.
Which API should I use to call Amazon Bedrock?
For new code, AWS recommends the bedrock-runtime endpoint. The Converse API is the simplest choice because one request format works across models. If your app already uses the OpenAI or Anthropic SDK, you can point it at Bedrock with a base URL and a Bedrock API key instead.
Can I use Amazon Bedrock without writing code?
Yes, for testing. The console playgrounds let you chat with models, compare prompts and adjust settings with no code. To put Bedrock inside an app, website or workflow you still need an SDK, the AWS CLI or another AWS service that calls it for you.
How do I keep Amazon Bedrock data in the UK or EU?
Build in a European Region such as London (eu-west-2) and use a model ID with the eu. inference profile prefix. That keeps processing inside the EU geography, while global. profiles may route requests to any commercial Region. Check each model card, because not every model offers a geographic profile.
Conclusion
Using Amazon Bedrock comes down to a short loop: test the prompt in the playground, call the model with the Converse API, then add the guardrail, documents and logging your users will need.
- Choose the Region and inference profile prefix first; they decide where data is processed.
- Use IAM roles in production and short-term API keys for tests.
- Set
maxTokenson every call; it’s your per-answer cost cap. - Guardrails don’t check tool inputs and results, so validate those yourself.
- Turn on invocation logging and a billing alert before anyone else uses the app.
Recommended reading
- Amazon Bedrock AgentCore Gateway: turn APIs into MCP tools
- AWS AI Practitioner (AIF-C01) study guide
- What is AWS SageMaker?
- How much does AWS cost? Three real monthly bills
I am an Amazon Web Services Professional, having more than 11 years of experience in AWS and other technologies. Extensively working in various AWS tools like S3, Lambda, API, Kinesis, Load Balancers, EKS, ECS, and many more. Working as a Solution Architect and Technology Lead for Architecting and implementing the same for different clients. He provides expert solutions around the world and especially in countries like the United States, Canada, United Kingdom, Australia, New Zealand, etc. Check out the complete profile on About us.
