Overview and What You Will Learn
AWS offers ready-made AI services that you call through an API, so you can add vision, speech, language, search and recommendations to an application without training a model. For custom problems it offers Amazon SageMaker AI, and for generative AI it offers Amazon Bedrock. In this lab you chain several of these services from the AWS CLI, turning text into speech, speech into a redacted transcript, and text into sentiment and entities.
By the end you will be able to:
- Choose between pre-built AI services, generative AI on Bedrock, and custom models on SageMaker AI
- Match common needs to Rekognition, Transcribe, Polly, Translate, Comprehend, Lex, Kendra, Textract and Personalize
- Redact personal data from transcripts and moderate images and video
- Chain several services into one workflow
- Avoid the cost, privacy and compliance traps that come with AI services
Why This Matters in Production
A video platform such as Hotstar cannot have people review every uploaded clip, so an automated moderation step can score content and send only borderline cases to human reviewers. A payments company such as Razorpay can read bank statements and invoices with Textract and make them searchable instead of having support staff search PDFs by hand. A food delivery company such as Swiggy can use Personalize to suggest restaurants from order history without a team to run recommendation models.
Each of these is an API call, not a research project. The skill is knowing which service fits, what it costs per call, and where human review and privacy rules still apply.
Core Principles
Which AWS AI Service Category Should You Start With?
Start with the most ready-made option that solves the problem and move toward custom only when you must. Pre-built AI services need no ML knowledge and bill per request. Bedrock gives you foundation models through an API for text, chat and image generation. SageMaker AI is for training and hosting your own models, which needs ML skills and costs more to build and run.
| Category | Use when |
|---|---|
| Pre-built AI services | The task is common, such as OCR, speech or sentiment |
| Amazon Bedrock | You need generative AI such as summaries, chat or RAG |
| SageMaker AI | Your data or domain needs a custom model |
RememberAWS changes service availability and names over time, and some services are closed to new customers. Check the current documentation and your Region before designing around a specific service.
What Does Amazon Rekognition Do?
Rekognition analyses images and video to detect objects, scenes, text, faces and unsafe content. It returns labels with confidence scores, so your code decides what confidence is good enough to act on. Video analysis runs asynchronously and returns results with timestamps.
- Labels: Objects and scenes such as car, road or helmet
- Text in images: Signs, plates and printed forms
- Faces: Detect, compare two faces for similarity, and search a collection
- Content moderation: Categories such as explicit content or violence, with confidence scores
- Custom Labels: Train a detector for objects specific to your business
A common moderation flow uses thresholds that you tune: auto-reject above a high confidence, send the middle band to a human review queue, and approve below a low confidence.
SecurityFacial comparison and search handle biometric data. Many jurisdictions require consent and restrict storage and use, and AWS has its own use policies, for example around law enforcement. Confirm the legal basis before building systems that identify people by face.
What Does Amazon Transcribe Do?
Transcribe converts speech to text, with punctuation, timestamps and speaker labels. It supports many languages including Indian English and Hindi, custom vocabularies for domain words such as UPI or NEFT, and streaming for live audio. Call Analytics and medical variants add features for contact centres and clinical speech.
Its PII redaction masks personal details in the transcript, which matters for support recordings.
Heard: "My name is Rahul Sharma and my number is 9876543210"Redacted: "My name is [NAME] and my number is [PHONE]"Redaction covers the entity types AWS defines, so confirm that your region-specific identifiers, such as Indian PAN numbers, are covered or add a second check.
What Does Amazon Polly Do?
Polly turns text into natural speech in many voices and languages. Standard voices are the older style, and neural, long-form and generative voices sound more natural. Indian English and Hindi voices are available. SSML markup lets you control pauses, emphasis, speaking rate and pronunciation.
Your balance is <emphasis>zero</emphasis>. <break time="500ms"/> Please add funds.Typical uses are IVR prompts, accessibility features, audio versions of articles and notifications.
What Does Amazon Translate Do?
Translate converts text between a large set of languages, and it can detect the source language automatically. Custom terminology keeps brand and product names unchanged. Use it for user-generated content, multilingual support messages and localizing app text.
What Does Amazon Comprehend Do?
Comprehend extracts meaning from text. It returns sentiment (positive, negative, neutral or mixed), entities such as people, places and dates, key phrases, language and PII. Topic modeling can group thousands of documents, and Comprehend Medical handles clinical text.
- "Worst delivery ever, food was cold" returns NEGATIVE with a high confidence
- "Rahul Sharma from Mumbai ordered on 15 January" returns PERSON, LOCATION and DATE entities
What Does Amazon Lex Do?
Lex builds voice and text chatbots on conversational technology related to Alexa, and it keeps context across turns. A bot is built from intents, slots and fulfilment.
- Intent: What the user wants, such as OrderFood or CheckBalance
- Slot: A detail Lex must collect, such as restaurant or size
- Fulfilment: A Lambda function that runs once the slots are filled
Lex pairs with Amazon Connect for contact centres, where a bot handles simple requests and hands complex ones to a human agent.
What Does Amazon Kendra Do?
Kendra is an enterprise search service that indexes documents from sources such as S3, SharePoint, Confluence, Salesforce, ServiceNow and databases, and answers natural language questions. Instead of a list of keyword matches, it can return the passage that answers the question. It can also act as the retrieval layer for generative AI apps. Index once, then search many sources.
What Does Amazon Textract Do?
Textract goes beyond OCR by understanding document structure. It extracts text, tables with their rows and columns, form key-value pairs, signatures, and answers to natural language queries such as "what is the invoice total". Specialised calls handle invoices and receipts, and identity documents.
- Use synchronous calls for single-page images and asynchronous calls for multi-page PDFs
- Use it for bank statements, invoices, claims and onboarding forms
Common MistakeTreating national ID extraction as a simple automation. Some identity numbers, such as Aadhaar, have legal limits on collection, storage and display. Confirm the rules and the ID types Textract supports before you build a KYC flow.
What Does Amazon Personalize Do?
Personalize trains recommendation models from your users, items and interaction data, and serves real-time recommendations through an API. You supply the data, and it handles training and hosting. It returns item IDs, which your application maps to restaurants or products, and it needs a reasonable amount of interaction data to work well.
GET recommendations for user rahul-001Returns item IDs: R-114, R-902, R-377Your app maps the IDs to restaurant namesWhat Is Amazon Bedrock?
Bedrock provides foundation models from several providers through one API, so you can build generative AI features without managing model servers. It adds Knowledge Bases for retrieval-augmented generation over your documents, Agents for multi-step tasks, and Guardrails for filtering inputs and outputs. Use it for summaries, drafting, chat, classification and extraction where a fixed pre-built API does not fit.
When Should You Use SageMaker AI?
Use SageMaker AI when no pre-built service fits and you have the data and skills to train a custom model. It covers the full workflow: prepare data in S3, train on managed compute, evaluate, and deploy to an endpoint that your application calls. Options such as SageMaker Canvas and Autopilot lower the skill needed, and JumpStart offers pre-trained models.
- Examples: fraud detection on your own transaction patterns, demand forecasting on your inventory data
- Cost trap: real-time endpoints and notebooks bill while they run, so stop or delete them when finished
How Do You Chain AI Services Together?
Each service does one job, so real workflows connect them with Lambda, Step Functions or EventBridge. A support call can be transcribed with PII redacted, analysed for sentiment, translated for a global team and indexed for search.
Detailed Step-by-Step Practical Lab
This lab uses the CLI in ap-south-1 and costs a few cents at most. Replace rahul with your own suffix, since bucket names are global.
Step 1: Analyse text with Comprehend
aws comprehend detect-sentiment --region ap-south-1 --language-code en \ --text "Swiggy delivered my food in 15 minutes. Hot and fresh, amazing service!" \ --query 'Sentiment' --output text aws comprehend detect-entities --region ap-south-1 --language-code en \ --text "Rahul Sharma from Bengaluru ordered Rs 450 of food on 15th January 2026." \ --query 'Entities[].[Text,Type]' --output tableThe first command returns POSITIVE, and the second lists PERSON, LOCATION, QUANTITY and DATE entities.
Step 2: Translate text
aws translate translate-text --region ap-south-1 \ --text "Your order has been delivered. Thank you." \ --source-language-code auto --target-language-code hi \ --query 'TranslatedText' --output textStep 3: Turn text into speech with Polly
aws polly synthesize-speech --region ap-south-1 \ --engine neural --voice-id Kajal --language-code en-IN \ --output-format mp3 \ --text "Hello, my name is Rahul Sharma and my phone number is 9876543210." \ order-update.mp3Step 4: Transcribe the audio with PII redaction
aws s3 mb s3://devops-ml-lab-rahul --region ap-south-1aws s3 cp order-update.mp3 s3://devops-ml-lab-rahul/audio/order-update.mp3 aws transcribe start-transcription-job --region ap-south-1 \ --transcription-job-name devops-redaction-demo \ --language-code en-IN \ --media MediaFileUri=s3://devops-ml-lab-rahul/audio/order-update.mp3 \ --output-bucket-name devops-ml-lab-rahul \ --content-redaction RedactionType=PII,RedactionOutput=redacted aws transcribe get-transcription-job --region ap-south-1 \ --transcription-job-name devops-redaction-demo \ --query 'TranscriptionJob.TranscriptionJobStatus' --output textWhen the job completes, download and read the redacted transcript.
aws s3 cp s3://devops-ml-lab-rahul/devops-redaction-demo.json transcript.jsonpython3 -c "import json; print(json.load(open('transcript.json'))['results']['transcripts'][0]['transcript'])"The name and number should appear as masked placeholders.
Step 5: Detect labels and unsafe content with Rekognition
Upload any photo you own as photo.jpg.
aws s3 cp photo.jpg s3://devops-ml-lab-rahul/images/photo.jpg aws rekognition detect-labels --region ap-south-1 \ --image 'S3Object={Bucket=devops-ml-lab-rahul,Name=images/photo.jpg}' \ --max-labels 5 --min-confidence 80 \ --query 'Labels[].[Name,Confidence]' --output table aws rekognition detect-moderation-labels --region ap-south-1 \ --image 'S3Object={Bucket=devops-ml-lab-rahul,Name=images/photo.jpg}' \ --query 'ModerationLabels[].Name' --output textAn empty moderation result means no unsafe content was flagged.
Step 6: Read a document with Textract
Upload a sample invoice or bank statement image as invoice.png.
aws s3 cp invoice.png s3://devops-ml-lab-rahul/docs/invoice.png aws textract detect-document-text --region ap-south-1 \ --document 'S3Object={Bucket=devops-ml-lab-rahul,Name=docs/invoice.png}' \ --query 'Blocks[?BlockType==`LINE`].Text' --output textFor tables and forms, use analyze-document with --feature-types TABLES FORMS, and compare it with plain text output to see the structure it keeps.
Step 7: Clean up
aws transcribe delete-transcription-job --region ap-south-1 \ --transcription-job-name devops-redaction-demoaws s3 rb s3://devops-ml-lab-rahul --forceProduction Best Practices & Common Pitfalls
- Start with the simplest service that fits: Pre-built first, Bedrock for generative needs, SageMaker AI last.
- Keep a human in the loop: Send low-confidence and high-impact results to reviewers.
- Tune thresholds with real data: Confidence scores are not probabilities of being right.
- Redact before you store: Use Transcribe and Comprehend PII features, and encrypt outputs with KMS.
- Watch per-call costs: Estimate volume before putting a service on every upload.
- Process asynchronously at scale: Use S3 events, SQS and Step Functions for large jobs.
- Check data residency and consent: Faces, voice and ID documents carry legal duties.
- Stop idle SageMaker resources: Endpoints and notebooks bill by the hour.
Common MistakeJumping to SageMaker before trying a pre-built service. Custom training adds data preparation, tuning, hosting and maintenance, and many needs are solved by a single API call.
TipChain services with Step Functions so each step has retries and a visible history, and keep each Lambda small.
Quick Reference & Troubleshooting Commands
| Task | Command |
|---|---|
| Sentiment | aws comprehend detect-sentiment --language-code en --text "<text>" |
| Entities | aws comprehend detect-entities --language-code en --text "<text>" |
| Translate | aws translate translate-text --text "<text>" --source-language-code auto --target-language-code hi |
| Speech | aws polly synthesize-speech --voice-id Kajal --output-format mp3 --text "<text>" out.mp3 |
| Transcription status | aws transcribe get-transcription-job --transcription-job-name <name> |
| Image labels | aws rekognition detect-labels --image 'S3Object=<Bucket=b,Name=k>' |
| Document text | aws textract detect-document-text --document 'S3Object=<Bucket=b,Name=k>' |
| Problem | Likely cause and fix |
|---|---|
| Transcribe job fails | Unsupported format or language code mismatch. Check media and language. |
| Access denied on S3 media | Service cannot read the object. Check bucket policy and region. |
| Low accuracy on domain words | Add a custom vocabulary or custom terminology. |
| Textract misses a table | Low resolution or skew. Rescan at higher quality and use analyze-document. |
| Rekognition rejects the image | Unsupported format or too large. Use JPEG or PNG within size limits. |
| Unexpected AI bill | High-volume per-call services or idle SageMaker endpoints. Review usage and stop idle resources. |