Skip to content
intermediate Phase 13 · AWS Machine Learning

AI/ML Services

Use pre-built AI services — Rekognition, Comprehend, Lex, and Polly.

1h
0 problems
Topic Progress 0%

What Each Service Does

What Each Service Does

These are API-shaped AI services — you send data, receive structured predictions, and never manage models:

Service Input Output
Rekognition images, video labels, faces, moderation, celebrity and text detection
Comprehend text entities, sentiment, key phrases, language, PII
Lex user utterances intents, slot values for conversational flows
Polly text + SSML synthesized speech (standard and neural voices)

Each exposes a low-level boto3 API and is priced per request or unit of work. The design question is never "how do I host this" — it is whether the accuracy and customization ceiling of a pre-built model fits your task.

Calling the APIs

Calling the APIs

rekognition.detect_labels(
    Image={"S3Object": {"Bucket": "b", "Name": "p.jpg"}},
    MinConfidence=80,
)
comprehend.detect_sentiment(Text=text, LanguageCode="en")

lex.post_text(botName="OrderBot", userId="u1",
              sessionAttributes={}, inputText="where is my order")

polly.synthesize_speech(Text="<speak>Hello <break/></speak>",
                        OutputFormat="mp3", VoiceId="Joanna",
                        TextType="ssml")

Video work is asynchronous: StartLabelDetection returns a job id you poll with GetLabelDetection. Pass confidence thresholds explicitly — the default may return dozens of low-value labels you would otherwise filter in code.

Choosing and Pitfalls

Choosing and Pitfalls

Per-request pricing wins at modest volume and loses at scale — model the break-even before committing a high-throughput pipeline to managed APIs. When the task needs your domain's terminology, evaluate the custom options (Rekognition Custom Labels, Comprehend custom classification) — they require labeled training data of your own.

Traps: assuming video analysis is synchronous (it is not); shipping user text to Comprehend without a PII/privacy review; forgetting region availability — not every service runs in every region; and treating confidence scores as probabilities rather than ranking signals.

Interview: name the service by input modality and output type, then cite one operational constraint (async jobs, pricing curve, or region limits) that shaped your choice.

Quiz

1. Which service extracts sentiment and entities from support tickets?

Question 1 options

2. How does Rekognition analyze a 30-minute video?

Question 2 options

3. What powers Lex bots?

Question 3 options

Flashcards

Question

Rekognition scope

Answer

Image/video: labels, faces, moderation, celebrity and text detection.

Question

Comprehend scope

Answer

Text: entities, sentiment, key phrases, language, PII detection.

Question

Lex

Answer

Conversational bots from intents, utterances, and slots; fulfills via Lambda.

Question

Polly

Answer

Text-to-speech with SSML control; standard vs neural voices.

Question

Async video pattern

Answer

Start job → poll for results; never block a request thread on video analysis.

Revision Notes

Key Takeaways

  • 1. Choose by modality: image/video → Rekognition, text → Comprehend, dialogue → Lex, speech → Polly
  • 2. Video is async; confidence thresholds belong in your code
  • 3. Per-request pricing needs a break-even analysis at scale

Interview Tips

  • • Map each service to input and output types — interviewers test the boundary, not memorized features
  • • Mention privacy and region constraints when proposing to send user data to a managed AI API

Cheat Sheet

Rekognition=image/video labels+faces; Comprehend=text NLP; Lex=intent/slot bots; Polly=TTS with SSML. Video=async start/poll. Set MinConfidence; model per-request cost; check region + PII.

Continue Learning