DEV Community

Dipali Kulshrestha
Dipali Kulshrestha

Posted on

AI Services for Developers

Module Objectives

By the end of this module, learners will be able to:

  • Understand the AWS AI/ML service landscape
  • Choose between pre-trained AI services vs custom ML
  • Integrate AI services into applications using SDKs & APIs
  • Secure AI services using IAM roles
  • Build event-driven AI workflows
  • Get introduced to Generative AI on AWS (Bedrock)
  1. AWS AI Services Landscape (Big Picture)

Three Layers of AI on AWS

Applications

├── AI Services (Pre-trained)
│ Rekognition, Comprehend, Textract, Transcribe, Polly

├── ML Platforms
│ SageMaker AI

└── GenAI
Amazon Bedrock

When to Use What
Requirement ===> Best Choice
No ML expertise ===> AI Services
Custom ML models===> SageMaker
GenAI / LLMs ===> Bedrock

2. Pre-Trained AWS AI Services (Core Focus)

These services require NO model training.

3. Amazon Rekognition (Image & Video AI)

What It Does

  • Image and video analysis
  • Face detection
  • Label detection
  • Content moderation

Common Use Cases

  • Fraud detection
  • Identity verification
  • Content moderation

  • Developer Integration

  • API-based

  • SDK supported

4. Amazon Comprehend (NLP)

What It Does

  • Sentiment analysis
  • Key phrase extraction
  • Entity recognition
  • PII detection

Use Cases

  • Customer feedback analysis
  • Compliance checks
  • Document classification
  • Supported Input
  • Plain text
  • UTF-8 encoded documents

5. Amazon Textract (Document AI)

What It Does

  • OCR (text extraction)
  • Forms and tables
  • Structured document parsing

Use Cases

**Invoice processing

KYC onboarding

Financial documents**

6. Speech & Language AI

Amazon Transcribe

  • Speech-to-text
  • Call center analytics
  • Supports batch & streaming

Amazon Polly

  • Text-to-speech
  • Multiple voices & languages

Common Pattern

S3 → AI Service → Output to S3 / DB

7. Hands-On Lab 1: Text Analysis with Amazon Comprehend
Objective

Analyze sentiment using Comprehend.

Steps

Create IAM role with:

ComprehendReadOnly

Input sample text

Use AWS SDK (Python):

import boto3

client = boto3.client('comprehend')

response = client.detect_sentiment(
    Text="AWS AI services are powerful and easy to use",
    LanguageCode='en'
)

print(response['Sentiment'])

Enter fullscreen mode Exit fullscreen mode

Validation

Sentiment output returned

  1. Cost Considerations Service ===> Pricing Model Rekognition ===> Per image / minute Comprehend ===> Per text unit Textract ===> Per page Transcribe ===> Per second Polly ===> Per million characters

11. Intro to Amazon SageMaker AI

What SageMaker Is

  • End-to-end ML platform
  • Training, tuning, hosting

When Developers Should Use It

  • Need custom ML models
  • Data science involvement
  • Model lifecycle management

12. Introduction to Generative AI on AWS

Amazon Bedrock

  • Fully managed GenAI service
  • Access to foundation models
  • No infrastructure management

Common Use Cases

  • Chatbots
  • Code assistants
  • Document summarization

13. Hands-On Lab: Bedrock Text Generation

Objective

Generate text using Bedrock.

Steps (High-Level)

  • Enable Bedrock access
  • Assign IAM role
  • Call model using SDK
  • Capture output
  1. Bedrock text generation via SDK
import boto3
import json

bedrock = boto3.client(
    service_name = 'bedrock-runtime',
    region_name = 'us-east-1'
    )

input = {
  "modelId": "cohere.command-text-v14",
  "contentType": "application/json",
  "accept": "*/*",
  "body": "{\"prompt\":\"Please write a four liner poem on machine learning.\",\"max_tokens\":400,\"temperature\":0.75,\"p\":0.01,\"k\":0,\"stop_sequences\":[],\"return_likelihoods\":\"NONE\"}"
}

response = bedrock.invoke_model(body=input["body"],
                                    modelId=input["modelId"],
                                    accept=input["accept"],
                                    contentType=input["contentType"])

response_body = json.loads(response['body'].read())

print(response_body)

Enter fullscreen mode Exit fullscreen mode

Top comments (0)