What Is Amazon Bedrock? Generative AI APIs on AWS Explained
Bedrock lets your app talk to foundation models (Claude, Llama, Titan and others) over AWS APIs. You do not train a giant GPU farm first. Perfect for chat, summarise and classify — with strict token cost discipline.
What you'll learn in this chapter
- What Bedrock is
- Model access and regions
- Pricing mental model (tokens)
- Guardrails and IAM
- Cost warnings for student labs
1. Everyday example
Why do we need this?
A Swiggy support bot must turn a long complaint into a short category + reply draft. Building that model from scratch is years of work. Calling a foundation model with a good prompt can be a weekend.
What is it?
Amazon Bedrock is a fully managed service to use foundation models via API (and tools like Knowledge Bases / Agents). Providers include Amazon and third parties, depending on region and account enablement.
2. Model access
Why do we need this?
Not every model is on in every account/region by default.
What is it?
- Console → Bedrock → Model access / Model catalog — request access for the models you need.
- Check the model is available in your region (Mumbai support grows over time — verify live).
- Call with AWS SDK (
bedrock-runtime) using an IAM role that allowsbedrock:InvokeModelon specific model ARNs.
3. Tokens and money
You usually pay per input token and per output token. Long prompts + long answers + many test loops = surprise bills. Set budgets and alarms.
Lab discipline
Before any Bedrock lab: enable only one cheap model, set an AWS Budget alert (for example $5), keep max_tokens small, and never put Bedrock calls in an unbounded loop. If your org blocks Bedrock, skip the live call — reading this chapter is enough for the quiz.
4. Safety extras
- Guardrails: filter topics/PII patterns before/after the model.
- Least-privilege IAM on model IDs — not
*. - Do not send secrets or customer passwords in prompts.
- Log prompts carefully — they may contain personal data.
5. Bedrock vs SageMaker (again)
| Goal | Prefer |
|---|---|
| Chat, summarise, embed with a managed FM | Bedrock |
| Train a custom tabular/CV model on your labelled data | SageMaker |
| Fine-tune / customise some FMs on Bedrock where offered | Bedrock customisation features |
| Full training loop + custom containers | SageMaker |
6. Interview angles
Q. Do you manage GPUs for base FM calls?
No — Bedrock hosts the model.
Q. Main API family?
bedrock-runtime InvokeModel / Converse APIs.
Q. How billed?
Primarily tokens (plus optional extras).
Q. Guardrails?
Managed filters around model I/O.
Q. SageMaker instead?
When you must train/host your own model deeply.
Try at home
- Read current Bedrock pricing page for one model — note input vs output rates.
- Draft an IAM policy that allows InvokeModel on a single model ARN only.
In short
- Bedrock = foundation model APIs on AWS.
- Enable model access; use bedrock-runtime.
- Tokens cost money — budgets and small max_tokens.
- Prefer Bedrock for generative APIs; SageMaker for custom training.
Practice Tasks
Solapur Chaddar House is a home textiles business in Solapur. Vikas Kamble looks after its IT and cloud work. They count money in INR and run their AWS resources in the ap-south-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.
0 / 10
Easy List Bedrock models
Why: See which foundation models are offered in your Region.
What to do: List the foundation models available in Amazon Bedrock.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Easy List SageMaker endpoints
Why: Endpoints cost money every hour; list them to find forgotten ones.
What to do: List SageMaker endpoints.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Easy How many addresses in a /16?
Why: Picking a VPC size needs this count.
What to do: Solapur Chaddar House plans the VPC 10.86.0.0/16. How many IP addresses does it hold in total?
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy Port for SSH
Why: Security group rules need the right port.
What to do: Which TCP port must the security group open for SSH?
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy Show where you are
Why: Before you copy or delete anything, you must know which folder you are in.
What to do: Vikas Kamble logged in to the Solapur Chaddar House server and is not sure which folder the terminal is in. Print the current folder path.
- Find the Linux command that does this job.
- Add the options (like -r or -h) the task needs.
- Add the file names, folders or users in the right order.
- Use sudo if the job changes system files or users. Click Check answer.
Easy Read-only access to one bucket
Why: Least privilege: give only the actions and the bucket the job needs.
What to do: Write an identity policy that lets the user read objects (s3:GetObject) only in bucket solapurchaddar-data.
- Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
- In each statement write Effect, Action and Resource.
- Give only what the task needs (least privilege).
- Use double quotes and commas correctly. Click Check answer.
Medium Detect labels in an image
Why: Rekognition names objects in a photo, e.g. to tag product images.
What to do: Detect labels in s3://solapurchaddar-media/shop/p1.jpg (Bucket=solapurchaddar-media, Name=shop/p1.jpg), max 10 labels.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Medium Allow one Bedrock model
Why: Limit apps to the approved model so costs stay predictable.
What to do: Allow bedrock:InvokeModel on arn:aws:bedrock:ap-south-1::foundation-model/amazon.nova-lite-v1:0 only.
- Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
- In each statement write Effect, Action and Resource.
- Give only what the task needs (least privilege).
- Use double quotes and commas correctly. Click Check answer.
Medium Usable IPs in an AWS /24 subnet
Why: AWS keeps 5 addresses in every subnet.
What to do: How many addresses can Solapur Chaddar House use for servers in subnet 10.86.1.0/24 on AWS?
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard Ask a model a question
Why: Converse is one API shape for many models.
What to do: Call converse on model amazon.nova-lite-v1:0 with the messages in msgs.json.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Revision, comparison and interview cards
Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.






More cards: Ravi Sir's Cards.