Hands-On Lab: Exploring Practical AI Use Cases on AWS
Practical use cases for AI
Prerequisites
Before starting this lab, ensure you have the following ready:
- AWS Account: Active AWS account with Administrator or PowerUser access.
- AWS CLI: Installed and configured (
aws configure) with valid IAM credentials. - IAM Permissions: Your IAM user/role must have permissions for
s3:*,comprehend:*,translate:*, andpolly:*. - Prior Knowledge: Basic understanding of what Artificial Intelligence (AI) and Machine Learning (ML) are, as covered in the AWS Certified AI Practitioner (AIF-C01) curriculum.
Learning Objectives
By completing this lab, you will be able to:
- Identify practical business use cases for managed AI services (e.g., customer service, global reach, accessibility).
- Analyze text sentiment automatically using Amazon Comprehend.
- Localize content in real-time using Amazon Translate.
- Convert text to lifelike speech using Amazon Polly.
Concept Review
Before provisioning resources, it is important to understand how the services we are using fit into the broader AI ecosystem. AWS provides managed AI services that do not require you to train your own models—they fall under the broader umbrella of AI, relying heavily on pre-trained Deep Learning models.
| AWS Service | Core AI Domain | Practical Use Case |
|---|---|---|
| Amazon Comprehend | Natural Language Processing (NLP) | Automating customer support ticket routing based on sentiment. |
| Amazon Translate | NLP / Machine Translation | Expanding product availability by translating product reviews. |
| Amazon Polly | Speech Recognition / Voice Generation | Creating accessible audio versions of written content. |
Architecture Overview
In this lab, you will act as a developer using the AWS CLI to interact with three managed AI APIs. You will also use an Amazon S3 bucket to store the generated audio output.
Step-by-Step Instructions
Step 1: Create an S3 Bucket for Asset Storage
We need a place to store our generated assets (like audio files). S3 bucket names must be globally unique.
aws s3 mb s3://brainybee-lab-ai-usecases-<YOUR_ACCOUNT_ID> --region us-east-1[!TIP] Replace
<YOUR_ACCOUNT_ID>with your 12-digit AWS account number, or append a random string to make it unique.
📸 Screenshot: Terminal showing
make_bucket: brainybee-lab-ai-usecases-...
▶Console alternative
- Navigate to S3 in the AWS Management Console.
- Click Create bucket.
- Enter the bucket name:
brainybee-lab-ai-usecases-<YOUR_ACCOUNT_ID>. - Select us-east-1 as the region.
- Leave all other settings as default and click Create bucket.
Step 2: Analyze Customer Sentiment (Amazon Comprehend)
Use Case: Your company receives thousands of product reviews daily. Instead of reading them manually, you will use AI to automatically determine if a customer is happy or upset.
Run the following command to analyze a sample positive review:
aws comprehend detect-sentiment \
--region us-east-1 \
--language-code en \
--text "The new smart thermostat is absolutely amazing and saves me a lot of money!"📸 Screenshot: Terminal showing JSON output with
"Sentiment": "POSITIVE".
▶Console alternative
- Navigate to Amazon Comprehend in the AWS Console.
- On the left menu, select Real-time analysis.
- Scroll down to the Input text box and paste: "The new smart thermostat is absolutely amazing and saves me a lot of money!"
- Click Analyze and view the Sentiment tab below.
Step 3: Localize Content (Amazon Translate)
Use Case: You want to expand your smart home business to Spanish-speaking regions. You need to translate your marketing materials quickly.
aws translate translate-text \
--region us-east-1 \
--source-language-code "en" \
--target-language-code "es" \
--text "The new smart thermostat is absolutely amazing and saves me a lot of money!"▶Console alternative
- Navigate to Amazon Translate in the AWS Console.
- Set Source language to English and Target language to Spanish.
- Paste the review text into the source box.
- The translated text ("¡El nuevo termostato inteligente es absolutamente increíble y me ahorra mucho dinero!") will appear automatically on the right.
Step 4: Generate Voice for Accessibility (Amazon Polly)
Use Case: To make your website more accessible, you want to offer an audio version of your customer testimonials in Spanish.
We will synthesize the speech and save it to an MP3 file locally, then upload it to S3.
# 1. Synthesize the speech to a local file named speech.mp3
aws polly synthesize-speech \
--region us-east-1 \
--output-format mp3 \
--voice-id Lupe \
--text "¡El nuevo termostato inteligente es absolutamente increíble y me ahorra mucho dinero!" \
speech.mp3
# 2. Upload the MP3 to your S3 bucket
aws s3 cp speech.mp3 s3://brainybee-lab-ai-usecases-<YOUR_ACCOUNT_ID>/speech.mp3▶Console alternative
- Navigate to Amazon Polly in the AWS Console.
- Select Text-to-Speech.
- Choose Spanish as the Language and Lupe as the voice.
- Paste the translated Spanish text into the input box.
- Click Listen to speech to hear it, or Download MP3.
- Navigate to S3, open your bucket, and click Upload to upload the MP3.
Checkpoints
Run these verification commands to ensure your lab steps were successful:
-
Verify Bucket & File:
bashaws s3 ls s3://brainybee-lab-ai-usecases-<YOUR_ACCOUNT_ID>/Expected Output: You should see
speech.mp3listed with its timestamp and file size. -
Verify Comprehend Confidence: Review the JSON from Step 2. You should see
SentimentScorevalues. Notice that AI doesn't guarantee 100% certainty; it provides a probabilistic score (e.g.,"Positive": 0.998).
Cost Estimate
This lab uses AWS managed AI services which fall under the AWS Free Tier for a certain number of API calls per month:
- Amazon Comprehend: 50,000 units (5 million characters) free per month.
- Amazon Translate: 2 million characters free per month.
- Amazon Polly: 5 million characters free per month.
- Amazon S3: Standard free tier storage limits.
If your account is outside the Free Tier, this lab will cost less than $0.05.
Clean-Up / Teardown
[!WARNING] Remember to run the teardown commands to avoid ongoing charges. Even though S3 storage is cheap, leaving unused resources is a bad cloud practice.
Run the following commands to delete the objects and the S3 bucket. AI services (Comprehend, Translate, Polly) are stateless in this lab and do not require teardown.
# 1. Delete the local file
rm speech.mp3
# 2. Empty the S3 bucket
aws s3 rm s3://brainybee-lab-ai-usecases-<YOUR_ACCOUNT_ID> --recursive
# 3. Delete the S3 bucket
aws s3 rb s3://brainybee-lab-ai-usecases-<YOUR_ACCOUNT_ID>Troubleshooting
| Common Error | Cause | Fix |
|---|---|---|
BucketAlreadyExists | S3 bucket names are globally unique across all AWS customers. | Append a random string or your account ID to your bucket name. |
AccessDeniedException | The IAM user/role running the CLI does not have the required permissions. | Attach the AdministratorAccess or specific service policies (e.g., ComprehendReadOnly) to your IAM user. |
InvalidRegion | AWS CLI is defaulting to a region where a service isn't supported. | Explicitly add --region us-east-1 to your commands. |
Could not connect to the endpoint URL | Your internet connection is blocked, or the region name is misspelled. | Check your VPN/Firewall and ensure the region is typed correctly (us-east-1). |
Stretch Challenge
Ready to test your skills without step-by-step guidance? Try this:
Goal: Use Amazon Rekognition to analyze a public image of a warehouse and detect the objects (labels) inside it. This simulates an inventory tracking/manufacturing AI use case.
▶Show solution
# Provide an image directly from an S3 bucket (AWS hosts a public sample bucket for Rekognition)
aws rekognition detect-labels \
--region us-east-1 \
--image '{"S3Object":{"Bucket":"console-sample-images-us-east-1","Name":"skateboard.jpg"}}' \
--max-labels 5Note: Replace skateboard.jpg with another image name if you upload your own to your S3 bucket!