DEV Community

confident_prep
confident_prep

Posted on Originally published at confidentprep.com

๐Ÿ’ธ What Does One Amazon Bedrock Prompt Cost? Find Out From the CLI (Hands-on)

๐ŸŽค The interview question

"Your team wants to add an Amazon Bedrock chatbot. How would you work out what one prompt costs?"

It shows up in AIF-C01 prep and in real interviews. The strong answer: Bedrock charges per token, and every response tells you how many tokens it used. Let's prove that from the AWS CLI in 5 minutes. ๐Ÿ‘‡

๐Ÿ‘‰ Flow: Send one prompt โ†’ Read usage โ†’ Multiply by the price โ†’ Compare two prompts


๐Ÿ”ง Step 1: Set up

โœ… AWS CLI v2, signed in (aws sts get-caller-identity works)
โœ… Region us-east-1
โœ… Model access for Amazon Nova Micro (Bedrock console โ†’ Model access)


๐Ÿ’ฌ Step 2: Send one prompt with the Converse API

aws bedrock-runtime converse \
  --region us-east-1 \
  --model-id us.amazon.nova-micro-v1:0 \
  --messages '[{"role":"user","content":[{"text":"Explain overfitting in one sentence."}]}]' \
  --query '{answer: output.message.content[0].text, usage: usage}'
Enter fullscreen mode Exit fullscreen mode

โœ… Expected (your numbers will differ):

{
  "answer": "Overfitting is when a model learns the training data so closely ...",
  "usage": { "inputTokens": 8, "outputTokens": 24, "totalTokens": 32 }
}
Enter fullscreen mode Exit fullscreen mode

๐Ÿ‘€ That usage block is your bill, in tokens.


๐Ÿงฎ Step 3: Turn tokens into money

Open Amazon Bedrock pricing, find Nova Micro, and copy its price per 1,000 input tokens and per 1,000 output tokens.

IN=8; OUT=24                      # from usage
P_IN=<price per 1K input tokens>  # from the pricing page
P_OUT=<price per 1K output tokens>
awk -v i=$IN -v o=$OUT -v pi=$P_IN -v po=$P_OUT \
  'BEGIN { printf "USD %.8f per prompt\n", i/1000*pi + o/1000*po }'
Enter fullscreen mode Exit fullscreen mode

๐Ÿ’ก Multiply by prompts per day to get a daily cost. That's the number your manager wants.


๐Ÿงจ Break it on purpose

Ask for a long answer instead:

--messages '[{"role":"user","content":[{"text":"Explain overfitting in 500 words."}]}]'
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“ˆ outputTokens jumps, and output tokens cost more than input tokens. Then add --inference-config '{"maxTokens":50}' and watch the cost come back down.


๐Ÿงน Cost and cleanup

  • ๐Ÿ’ต A few prompts on Nova Micro cost a fraction of a cent
  • ๐Ÿงน Nothing to delete: Converse calls create no resources

๐ŸŽฏ What you can now say in the interview (and the exam)

โœ… "Bedrock on-demand pricing is per input and output token"
โœ… "Every Converse response returns inputTokens and outputTokens"
โœ… "Output tokens usually cost more, so I cap them with maxTokens"
โœ… "Cost per prompt ร— prompts per day = the daily bill"


๐Ÿ“š Go deeper

This is the hands-on cut of Chapter 5 of our free AWS AI Practitioner (AIF-C01) course: the full chapter explains tokens, why they drive cost, and how the exam asks about them.

๐Ÿ‘‰ Read the full chapter on Confident Prep

Top comments (0)