Skip to content
AWS

Your First Amazon Bedrock Call: Console, CLI and Python

Calling a foundation model on AWS three ways, and working out what each call cost

With a budget alert and a sandbox account in place, it is time to actually call a model. This post makes the same request three ways, from the Bedrock console, the AWS CLI and Python with boto3, and then works out what it cost from the token counts AWS returns.

What We Are Building

Nothing that stays running. We send one short prompt to Amazon Nova Micro, a small, cheap text model from AWS, and read back the answer and the token usage. I chose Nova Micro because it needs no extra sign-up form and costs a tiny fraction of a penny per call, which suits a first test.

Before We Start

  • The sandbox account and sandbox profile from the last post, signed in with aws sso login --profile sandbox
  • The Region used in this series, eu-west-2 (London). Nova Micro is listed as available there, but model availability changes, so check the Nova Micro model card for your Region
  • Python 3 for the last section, run inside a virtual environment (shown below with uv, with the standard library alternative)
  • Permission to call Bedrock. PowerUserAccess from the last post covers it

Model Access

Older guides tell you to go to a Model access page and request each model. That is no longer how it works. According to the Bedrock documentation, access to serverless foundation models is enabled by default, and you control who can use which model with IAM policies.

The one exception is Anthropic models (Claude). First-time users must submit a short use case form before the first call, either by opening a Claude model in the console playground or through the API. Nova does not need it, which is another reason it is a good starting point.

If You Get “Your Account Is Currently Being Verified”

When I first tried this in the console playground, in a freshly created sandbox account, it failed with:

text
AccessDeniedException
Your account is currently being verified. Verification normally takes less than 2 hours.
Until your account is verified, you may not have access to this operation.
If you are still receiving this message after more than 2 hours, please let us know
by writing to aws-verification@amazon.com.

This is not an IAM permissions problem, so changing your policies will not fix it. It is AWS checking the account, and a brand new account is the likely trigger. Nothing is wrong with your setup. In my case I simply ran it again a few minutes later and it worked, with no action needed. If it does not clear that quickly, wait and try again, and if it is still happening after the two hours the message mentions, email the address in the message, as it asks. The same error will appear from the CLI and Python, so you can come back to Options 2 and 3 afterwards.

Option 1: The Console

  1. Open Amazon Bedrock in the sandbox account, with eu-west-2 selected
  2. Choose Model catalog in the left-hand navigation and find Nova Micro
  3. Open it in the Playground, type a prompt such as Explain what an AWS Region is in two sentences. and run it
  4. Look for the run metrics shown with the response, which include the input and output token counts

Option 2: The AWS CLI

The Converse API gives the same request shape for every model, so you can swap the model later by changing one string.

bash
aws bedrock-runtime converse \
  --profile sandbox \
  --region eu-west-2 \
  --model-id amazon.nova-micro-v1:0 \
  --messages '[{"role":"user","content":[{"text":"Explain what an AWS Region is in two sentences."}]}]' \
  --inference-config '{"maxTokens":200,"temperature":0.2}'

The response contains the answer under output.message.content and a usage block with inputTokens, outputTokens and totalTokens.

To print just the answer and the usage:

bash
aws bedrock-runtime converse \
  --profile sandbox --region eu-west-2 \
  --model-id amazon.nova-micro-v1:0 \
  --messages '[{"role":"user","content":[{"text":"Explain what an AWS Region is in two sentences."}]}]' \
  --inference-config '{"maxTokens":200,"temperature":0.2}' \
  --query '{answer: output.message.content[0].text, usage: usage}'

Option 3: Python with boto3

First create a directory for the script and a virtual environment inside it, so boto3 does not land in your system Python. I use uv:

bash
mkdir bedrock-first-call
cd bedrock-first-call
uv venv
source .venv/bin/activate
uv pip install boto3

If you do not use uv, the built-in venv module does the same job:

bash
mkdir bedrock-first-call
cd bedrock-first-call
python3 -m venv .venv
source .venv/bin/activate
pip install boto3

Any other environment manager (conda, pipenv, poetry and so on) works too. All the script needs is boto3 available in the active environment.

Now save the following as first_call.py in that directory:

python
import boto3

session = boto3.Session(profile_name="sandbox", region_name="eu-west-2")
client = session.client("bedrock-runtime")

response = client.converse(
    modelId="amazon.nova-micro-v1:0",
    messages=[
        {
            "role": "user",
            "content": [{"text": "Explain what an AWS Region is in two sentences."}],
        }
    ],
    inferenceConfig={"maxTokens": 200, "temperature": 0.2},
)

print(response["output"]["message"]["content"][0]["text"])

usage = response["usage"]
print(f"input tokens:  {usage['inputTokens']}")
print(f"output tokens: {usage['outputTokens']}")

Run it with the environment still active:

bash
python first_call.py

When you are finished, run deactivate.

What It Cost

Bedrock charges per token, with separate prices for input and output. At the time of the AWS blog post I used for reference, Nova Micro on-demand pricing was $0.000035 per 1,000 input tokens and $0.00014 per 1,000 output tokens. Prices change, so check the Bedrock pricing page for your Region before relying on these.

The sum is straightforward:

text
cost = (inputTokens / 1000 x input price) + (outputTokens / 1000 x output price)

For a call with 20 input tokens and 60 output tokens that is about $0.0000007 + $0.0000084, so roughly $0.00001. A thousand calls like that would cost around a penny. Replace my numbers with the usage values from your own run.

Cleaning Up

There is no AWS resource to delete. Bedrock on-demand has no standing cost, you only pay when you make a call. Locally, run deactivate if you have not already, then delete the whole bedrock-first-call directory if you no longer need it.

What I’d Do Next

Put this behind an API: a Lambda function, API Gateway and Bedrock, deployed with infrastructure as code. That is the next post.