By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Topic: Amazon Bedrock (Foundation Models, Knowledge Bases, Agents)
Amazon Bedrock is AWS’s fully managed service for building generative AI applications using foundation models (FMs) from leading AI providers (Anthropic, Cohere, Meta, Mistral, Stability AI, and Amazon Titan). It simplifies deploying, fine-tuning, and integrating LLMs into production workflows without managing infrastructure. Real-world scenario: A healthcare startup uses Bedrock to power a HIPAA-compliant patient triage chatbot that retrieves answers from internal medical guidelines (via Knowledge Bases) and routes complex cases to human doctors (via Agents). Bedrock handles model hosting, security, and scaling, while the team focuses on prompt engineering and business logic.
Scenario: Build a customer support chatbot using Claude 3 Haiku (fast, cost-effective).1. Enable the model in the Bedrock console (select Claude 3 Haiku under "Model access").2. Configure IAM permissions: Grant your app’s role bedrock:InvokeModel on the model ARN (e.g., arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-haiku-20240307-v1:0).3. Call the model via API: python import boto3 bedrock = boto3.client("bedrock-runtime", region_name="us-east-1") response = bedrock.invoke_model( modelId="anthropic.claude-3-haiku-20240307-v1:0", body=json.dumps({ "messages": [{"role": "user", "content": "Summarize this support ticket: ..."}], "max_tokens": 200 }) ) 4. Optimize for cost/latency: - Use Provisioned Throughput if you need guaranteed performance. - For low-volume apps, stick to on-demand pricing.
bedrock:InvokeModel
arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-haiku-20240307-v1:0
python import boto3 bedrock = boto3.client("bedrock-runtime", region_name="us-east-1") response = bedrock.invoke_model( modelId="anthropic.claude-3-haiku-20240307-v1:0", body=json.dumps({ "messages": [{"role": "user", "content": "Summarize this support ticket: ..."}], "max_tokens": 200 }) )
Scenario: Create a legal document assistant that answers questions using a firm’s internal case files.1. Prepare your data: - Store documents in S3 (e.g., s3://legal-docs/briefs/). - Ensure files are chunked (e.g., 1,000-token segments) for efficient retrieval.2. Create a Knowledge Base: - In the Bedrock console, select Knowledge Bases → Create Knowledge Base. - Choose a data source (S3) and a vector store (e.g., Aurora PostgreSQL with pgvector or OpenSearch Serverless).3. Sync data: - Bedrock automatically ingests, chunks, and embeds your data using the selected FM (e.g., Titan Embeddings).4. Query the Knowledge Base: python response = bedrock.retrieve_and_generate( input={"text": "What was the ruling in Smith v. Jones (2023)?"}, retrieveAndGenerateConfiguration={ "type": "KNOWLEDGE_BASE", "knowledgeBaseConfiguration": { "knowledgeBaseId": "KB12345678", "modelArn": "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-embed-text-v1" } } ) 5. Monitor performance: - Use CloudWatch to track latency, token usage, and retrieval accuracy.
s3://legal-docs/briefs/
python response = bedrock.retrieve_and_generate( input={"text": "What was the ruling in Smith v. Jones (2023)?"}, retrieveAndGenerateConfiguration={ "type": "KNOWLEDGE_BASE", "knowledgeBaseConfiguration": { "knowledgeBaseId": "KB12345678", "modelArn": "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-embed-text-v1" } } )
Scenario: Build a travel booking Agent that checks flight availability, books hotels, and updates a calendar.1. Define the Agent: - In the Bedrock console, select Agents → Create Agent. - Choose an FM (e.g., Claude 3 Sonnet) and provide a description (e.g., "Book travel and update calendar").2. Add Actions: - Define API integrations (e.g., Lambda functions for flight/hotel APIs, DynamoDB for user preferences). - Example action: json { "name": "book_flight", "description": "Books a flight using the Amadeus API", "apiSchema": { "type": "awsLambda", "lambdaArn": "arn:aws:lambda:us-east-1:123456789012:function:book-flight" } } 3. Test the Agent: - Use Bedrock Studio to simulate conversations (e.g., "Book a flight to Paris for next week"). - The Agent will break the task into steps, call APIs, and use the FM to reason.4. Deploy the Agent: - Expose it via API Gateway or integrate with Amazon Connect for a call center.
json { "name": "book_flight", "description": "Books a flight using the Amadeus API", "apiSchema": { "type": "awsLambda", "lambdaArn": "arn:aws:lambda:us-east-1:123456789012:function:book-flight" } }
Knowledge Bases vs. OpenSearch: Knowledge Bases are managed RAG solutions with built-in embeddings and retrieval. OpenSearch is a search engine—use it if you need custom ranking or hybrid search.
Key Constraints:
Agent limitations: Agents can’t modify their own code or learn from interactions (they’re stateless). Use DynamoDB or S3 to persist state.
Tricky Scenarios:
Cost optimization: For low-latency, high-volume apps, use Provisioned Throughput. For sporadic usage, stick to on-demand.
Which Service?:
Answer: Amazon Bedrock (Knowledge Bases) + Aurora PostgreSQL (pgvector) + Guardrails. Explanation: Bedrock Knowledge Bases provide RAG with private data, Aurora supports HIPAA, and Guardrails enforce compliance.
A startup is prototyping a travel booking Agent that calls external APIs (e.g., Expedia, Google Calendar). They want to minimize infrastructure management. Which AWS service should they use?
Answer: Agents for Amazon Bedrock. Explanation: Bedrock Agents handle multi-step workflows, API integrations, and FM reasoning without managing servers.
A data scientist needs to fine-tune an LLM for a legal document classification task. They have 5,000 labeled examples. Which AWS service should they use?
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.