January 2026

Creating an AWS Linux System and Using Amazon Polly (CLI, Python, and GUI)


Amazon Polly makes it easy to convert text into natural-sounding speech using AI-powered voices. Whether you prefer clicking through a web interface or automating everything on a Linux server, Polly has you covered.

In this guide, we’ll:

  • Launch an Amazon Linux EC2 instance
  • Use Amazon Polly from the AWS Console (GUI)
  • Generate speech using the AWS CLI
  • Create audio files programmatically with Python

What Is Amazon Polly?

Amazon Polly is a managed text-to-speech service that:

  • Converts text into lifelike speech
  • Supports multiple languages and neural voices
  • Outputs MP3, OGG, and PCM audio formats
  • Requires no infrastructure management

Prerequisites

You’ll need:

  • An AWS account
  • An EC2 key pair
  • Basic Linux knowledge
  • An IAM user or role with Polly permissions

Step 1: Launch an Amazon Linux EC2 Instance

  1. Go to AWS EC2 Console
  2. Click Launch Instance
  3. Choose Amazon Linux 2
  4. Select t2.micro or t3.micro
  5. Allow SSH (port 22) in the security group
  6. Launch the instance

Copy the public IP address once the instance is running.


Step 2: Connect to the EC2 Instance

ssh -i your-key.pem ec2-user@<EC2_PUBLIC_IP>

You are now logged into your Amazon Linux server.


Step 3: Using Amazon Polly via the AWS Console (GUI)

Before touching the command line, let’s explore Polly using the AWS Management Console — this is the fastest way to experiment.

Accessing the Polly Console

  1. Log in to the AWS Management Console
  2. Search for Polly
  3. Click Amazon Polly
  4. Open the Text-to-Speech page

No EC2 instance is required for this step.


Generating Speech in the GUI

  1. In the Text-to-Speech editor:
    • Enter your text:
Welcome to Amazon Polly. This audio was created using the AWS Console.

  1. Choose a voice (e.g., Joanna, Matthew)
  2. Select Engine:
    • Standard
    • Neural (more natural, recommended)
  3. Choose Language
  4. Click Listen ▶️

You’ll hear the generated speech instantly.


Downloading the Audio File

  1. Select Output format (MP3 or OGG)
  2. Click Download
  3. Save the file locally

This is perfect for:

  • Testing voices
  • Demos and presentations
  • Content creation workflows

Using SSML in the GUI (Optional)

Enable SSML to control speech:

<speak>
  Welcome to <emphasis level="strong">Amazon Polly</emphasis>.
  <break time="1s"/>
  This is an example using SSML.
</speak>

SSML allows:

  • Pauses
  • Emphasis
  • Speaking rate control
  • Pronunciation tuning

Step 4: Configure AWS Credentials on Linux

Recommended: IAM Role

Attach an IAM role to the EC2 instance with:

  • AmazonPollyFullAccess

No credentials required on the server.

Alternative: AWS CLI Credentials

aws configure

Enter:

  • Access key
  • Secret key
  • Region (e.g., us-east-1)

Step 5: Using Amazon Polly from the AWS CLI

Generate speech directly from Linux:

aws polly synthesize-speech \
  --voice-id Joanna \
  --output-format mp3 \
  --text "This audio was generated from the AWS CLI" \
  cli-output.mp3

Install an audio player:

sudo yum install -y mpg123

Play the file:

mpg123 cli-output.mp3

Step 6: Using Amazon Polly with Python

Install Dependencies

sudo yum install -y python3 pip
pip3 install boto3

Python Script Example

Create the script:

nano polly_tts.py

Add:

import boto3

polly = boto3.client("polly")

response = polly.synthesize_speech(
    Text="Hello from Amazon Polly using Python on Amazon Linux",
    OutputFormat="mp3",
    VoiceId="Matthew"
)

with open("python-output.mp3", "wb") as file:
    file.write(response["AudioStream"].read())

print("Audio file created: python-output.mp3")

Run it:

python3 polly_tts.py
mpg123 python-output.mp3

Comparing GUI vs CLI vs Code

MethodBest For
AWS Console (GUI)Voice testing, demos, learning
AWS CLIAutomation, scripting
Python / SDKApplication integration

Security Best Practices

  • Prefer IAM roles over access keys
  • Use least-privilege IAM policies
  • Monitor usage with CloudWatch
  • Avoid committing credentials to Git

Conclusion

Amazon Polly is flexible enough for beginners and powerful enough for production systems. Whether you use the AWS Console GUI, CLI, or Python SDK, Polly lets you bring natural-sounding speech to your applications quickly and securely.

Once you’re comfortable, you can combine Polly with:

  • S3 for audio storage
  • Lambda for serverless processing
  • Transcribe for full speech workflows

Happy building—and enjoy giving your apps a voice 🔊🚀


Creating an AWS Linux System Running Docker and Managing It with Portainer

Running containers in the cloud doesn’t have to be complicated. In this guide, we’ll walk through creating an AWS EC2 Linux instance, installing Docker, and setting up Portainer to manage containers visually and effortlessly.

By the end, you’ll have a lightweight, production-ready Docker host you can control from your browser.


Prerequisites

Before we begin, make sure you have:

  • An AWS account
  • Basic familiarity with Linux and SSH
  • An EC2 key pair for secure access
  • A local machine with SSH installed

Step 1: Launch an AWS EC2 Linux Instance

  1. Log in to the AWS Management Console
  2. Navigate to EC2 → Launch Instance
  3. Choose an AMI:
    • Select Amazon Linux 2 (recommended for stability and AWS compatibility)
  4. Choose an instance type:
    • t2.micro or t3.micro (free tier eligible)
  5. Configure key settings:
    • Attach your key pair
    • Allow SSH (port 22) in the security group
    • Add port 9000 (Portainer UI) and port 80 if you plan to run web apps
  6. Launch the instance 🚀

Once running, copy the public IPv4 address.


Step 2: Connect to the EC2 Instance

From your local terminal:

ssh -i your-key.pem ec2-user@<EC2_PUBLIC_IP>

If successful, you’ll be logged into your Amazon Linux server.


Step 3: Install Docker on Amazon Linux

Update the system:

sudo yum update -y

Install Docker:

sudo amazon-linux-extras install docker -y

Start and enable Docker:

sudo systemctl start docker
sudo systemctl enable docker

(Optional) Allow your user to run Docker without sudo:

sudo usermod -aG docker ec2-user
exit

Reconnect to apply the changes.

Verify installation:

docker --version

Step 4: Run Docker Containers

Test Docker by running a container:

docker run hello-world

If you see the success message, Docker is working correctly 🎉


Step 5: Install Portainer

Portainer gives you a clean web UI to manage containers, images, networks, and volumes.

Create a Docker volume for Portainer

docker volume create portainer_data

Run Portainer

docker run -d \
  -p 9000:9000 \
  --name portainer \
  --restart always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v portainer_data:/data \
  portainer/portainer-ce

Check that it’s running:

docker ps

Step 6: Access the Portainer Dashboard

Open your browser and go to:

http://<EC2_PUBLIC_IP>:9000

On first launch:

  1. Create an admin password
  2. Select Docker (local) as the environment
  3. Click Connect

You now have full visual control over your Docker host 🎯


What You Can Do with Portainer

With Portainer, you can:

  • Deploy containers using forms or Docker Compose
  • Monitor container health and logs
  • Manage volumes, networks, and images
  • Stop, start, or scale services
  • Secure access with user roles

It’s perfect for:

  • Small production workloads
  • Learning Docker visually
  • Managing remote servers with ease

Security Best Practices

Before using this in production, consider:

  • Restricting port 9000 to your IP only
  • Enabling HTTPS with a reverse proxy
  • Using IAM roles instead of access keys
  • Regularly updating Docker and the OS

Conclusion

By combining AWS EC2, Amazon Linux, Docker, and Portainer, you get a powerful yet simple container platform that scales with your needs. Whether you’re deploying side projects or learning container orchestration, this setup is an excellent foundation.

Happy containerizing 🐳🚀