AI Services provide pre-trained ML models via simple APIs. No ML expertise, no training data, no model deployment — just call an API and get a result. Pay per use.
comprehend = boto3.client('comprehend')# Detect sentimentresponse = comprehend.detect_sentiment( Text="I absolutely love this product! Best purchase ever.", LanguageCode='en')print(response['Sentiment']) # POSITIVEprint(response['SentimentScore']) # {POSITIVE: 0.99, ...}
Entity Detection
# Detect entities (people, places, organizations)response = comprehend.detect_entities( Text="Amazon opened its new office in Seattle last week. CEO Andy Jassi announced.", LanguageCode='en')for entity in response['Entities']: print(f"{entity['Type']}: {entity['Text']} (Score: {entity['Score']:.2f})")
PII Detection
# Detect personally identifiable informationresponse = comprehend.detect_pii_entities( Text="Customer John Smith, SSN 123-45-6789, email john@example.com", LanguageCode='en')for pii in response['Entities']: print(f"{pii['Type']}: {pii['Score']:.2f}")
Medical Comprehend (HIPAA Eligible)
medical = boto3.client('comprehendmedical')# Detect medical entitiesresponse = medical.detect_entities_v2( Text="Patient has Type 2 diabetes. Takes 500mg Metformin twice daily.")for entity in response['Entities']: print(f"{entity['Category']}: {entity['Text']} ({entity['Type']})")
Polly (Text-to-Speech)
polly = boto3.client('polly')# Synthesize speechresponse = polly.synthesize_speech( Text="Hello! Welcome to AWS machine learning services.", OutputFormat='mp3', VoiceId='Joanna' # Neural voice)# Save to filewith open('welcome.mp3', 'wb') as f: f.write(response['AudioStream'].read())
Speech Synthesis Marks (SSML)
response = polly.synthesize_speech( Text='<speak><prosody rate="slow">This is slow.</prosody> <break strength="strong"/> <prosody rate="fast">This is fast.</prosody></speak>', OutputFormat='mp3', VoiceId='Joanna', TextType='ssml')
Translate
translate = boto3.client('translate')# Translate textresponse = translate.translate_text( Text="Hello, how are you?", SourceLanguageCode='en', TargetLanguageCode='es')print(response['TranslatedText']) # "Hola, ¿cómo estás?"
AI Services return confidence scores — 99% confidence doesn’t mean 100% correct: Always treat AI Service outputs as probabilistic. For high-stakes decisions, add human review or validation. A 99% confidence face match is still wrong 1% of the time.
Rekognition’s face comparison is NOT identity verification — it’s similarity scoring: Rekognition tells you two faces are 95% similar. It doesn’t tell you WHO the person is. For identity verification, use Amazon Verify or a different approach.
Comprehend Medical is a separate service with different pricing — Comprehend (general) is NOT HIPAA eligible: If you need HIPAA-compliant NLP, use comprehendmedical endpoint, not comprehend. They’re separate APIs with different compliance certifications.
Transcribe supports custom vocabularies but not custom models — if your domain vocabulary is niche, build a custom vocabulary: Custom vocabulary improves accuracy for domain-specific terms (medical, legal, technical). Without it, “Glucoma” gets transcribed as “Glaucoma” incorrectly.
AI Services are eventually consistent — for the same input, you might get slightly different outputs over time: If you need deterministic outputs (for testing or compliance), be aware that AI Service outputs can vary slightly between calls for the same input.