By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Study Guide for Data Engineers & ML Practitioners
Prompt engineering and Retrieval-Augmented Generation (RAG) are techniques to improve LLM outputs by crafting precise instructions (prompts) and grounding responses in external knowledge (retrieval). In AWS, this is critical for building secure, scalable, and cost-effective generative AI applications—like a customer support chatbot that pulls answers from a company’s knowledge base (e.g., PDFs, FAQs, or databases) instead of hallucinating. RAG reduces hallucinations, improves accuracy, and enables private data integration without fine-tuning.
Real-world scenario:A healthcare provider wants to deploy an LLM-powered clinical assistant that answers doctor queries using internal medical guidelines (stored in S3 as PDFs) while complying with HIPAA. They use Amazon Bedrock for the LLM, Amazon OpenSearch Serverless for vector search, and AWS Lambda to orchestrate retrieval and prompt construction.
Amazon Bedrock AWS’s fully managed service for building generative AI apps using foundation models (FMs) from Anthropic, Meta, AI21, and Amazon. Supports RAG, fine-tuning, and inference with built-in security (VPC, IAM, KMS). Best for enterprise-grade LLM deployments without managing infrastructure.
Amazon OpenSearch Serverless (Vector Engine) A serverless vector database for semantic search and RAG. Stores embeddings (from models like Titan Embeddings or Hugging Face) and performs k-NN similarity searches at scale. Ideal for low-latency retrieval in chatbots or recommendation systems.
Amazon Kendra AWS’s enterprise search service with ML-powered ranking and natural language understanding (NLU). Supports structured (databases) and unstructured (PDFs, HTML) data with pre-built connectors (S3, SharePoint, Salesforce). Best for document-heavy RAG where keyword + semantic search is needed.
AWS Lambda Serverless compute for running prompt engineering logic (e.g., formatting retrieved context into a prompt). Scales automatically and integrates with Bedrock, OpenSearch, and API Gateway for real-time RAG pipelines.
Amazon SageMaker JumpStart A model hub with pre-trained models (e.g., Flan-T5, Falcon) and one-click deployments. Useful for fine-tuning embeddings or hosting custom RAG models if Bedrock’s FMs don’t meet requirements.
Amazon Titan Embeddings AWS’s foundation embedding model (via Bedrock) that converts text into vector representations for semantic search. Optimized for low-latency retrieval in RAG pipelines.
AWS Glue / Amazon Athena ETL (Glue) and serverless SQL query (Athena) services for preprocessing documents (e.g., chunking PDFs, cleaning text) before indexing in OpenSearch/Kendra.
Role prompting (e.g., "You are a medical expert answering patient questions").
Retrieval-Augmented Generation (RAG) A pattern where an LLM retrieves relevant context (e.g., documents, database records) before generating a response. Steps:
Generate a response using the LLM.
Chunking Strategy How you split documents into smaller pieces for indexing. Common methods:
Overlapping chunks (to avoid cutting off context).
Embedding Model A model that converts text into dense vector representations (e.g., 1536-dimensional vectors for Titan Embeddings). The quality of embeddings directly impacts RAG performance.
Vector Database A database optimized for storing and querying embeddings (e.g., OpenSearch, Pinecone, Weaviate). Supports approximate nearest neighbor (ANN) search for fast retrieval.
Hallucination When an LLM generates false or unsupported information. RAG reduces hallucinations by grounding responses in retrieved facts.
Deploy a customer support chatbot that answers questions using a company’s internal knowledge base (PDFs in S3).
s3://company-knowledge-base/
knn_vector
Exam trap: If the question mentions PDFs in S3 + semantic search, pick Kendra. If it’s high-scale vector search, pick OpenSearch.
Bedrock vs. SageMaker for RAG:
Exam trap: If a question asks about long documents, check if the model supports the required token length.
OpenSearch Serverless limits:
A fintech company wants to build a RAG-powered fraud detection assistant that answers analyst queries using internal transaction logs (stored in DynamoDB). The solution must support low-latency retrieval and scale to millions of records. Which AWS service should they use for the retrieval layer? - A) Amazon Kendra - B) Amazon OpenSearch Serverless - C) Amazon Aurora PostgreSQL with pgvector - D) AWS Glue
Answer: B) Amazon OpenSearch ServerlessOpenSearch is optimized for low-latency vector search at scale, while Kendra is better for document search with NLU. Aurora + pgvector is an option but requires more management.
A healthcare startup is using Amazon Bedrock for a clinical decision support tool. They want to reduce hallucinations by grounding responses in internal medical guidelines (PDFs in S3). Which two services should they use to implement RAG? (Select TWO.) - A) Amazon Textract - B) Amazon OpenSearch Serverless - C) Amazon SageMaker Ground Truth - D) AWS Lambda - E) Amazon Comprehend
Answer: A) Amazon Textract and B) Amazon OpenSearch ServerlessTextract extracts text from PDFs, and OpenSearch indexes embeddings for retrieval. Lambda (D) is needed for orchestration but isn’t one of the two core services here.
A company is fine-tuning a custom embedding model for their domain-specific RAG pipeline. They need full control over the training process and want to deploy the model behind a secure endpoint. Which AWS service should they use? - A) Amazon Bedrock - B) Amazon SageMaker - C) AWS Lambda - D) Amazon OpenSearch
Answer: B) Amazon SageMakerBedrock doesn’t support custom embedding models, and SageMaker provides fine-tuning + deployment capabilities. Lambda is for orchestration, not training.
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.