AWS Polly — credentials

Michael Ludvig

This is a side-story for the main article about AWS Polly.

Photo by Jose Fontano on Unsplash

AWS Account

Before we can use any AWS services we need an AWS account. If you don’t already have one Create a Free AWS Account now. The account creation requires a credit card however as long as you stay within the Free Tier you won’t be charged anything.

AWS Polly User

Once we have an account open we will need the credentials for our script. Explaining the AWS Security model is well beyond the scope of this article, suffice to say that we’ll create a so called IAM User with an attached IAM Policy that gives it access to the AWS Polly service.

In the Web interface — also known as AWS Console — select Services in the top-left corner, then IAM, then Users and finally click the Add User button. We’ll be asked for User name — make it for example polly— and for AWS Access Type — select Programmatic access.

On the next screen we’re asked for permissions — first click the large “Attach policies directly” button and then type AmazonPollyFullAccess into the filter. Select the policy that shows up in the list.

Skip over Tags, they are optional, and check that all the details are correct on the Review screen. If it all looks good click Create user.

Now the important part — the next screen displays the Access Key and Secret Key. Do not close this page yet! We will need the keys in the next step.

Configure aws-cli and boto3 credentials

Now that we have the Access Key and Secret Key created we can finally configure the aws-cli and boto3 credentials. They happen to use the same config file ~/.aws/credentials which is the standard across all the official AWS SDKs for all programming languages.

Run aws configure and fill in the Access and Secret keys created in the previous step.

pi@polly:~ $ aws configure
AWS Secret Access Key [None]: abcdefgh....
Default region name [None]: us-east-1
Default output format [None]: json

Just to make sure it works as expected we can test it.

pi@polly:~ $ aws sts get-caller-identity
"Arn": "arn:aws:iam::123456789012:user/polly",
"Account": "123456789012"

That looks good! Now you can return to the main article about AWS Polly.


 by the author.

Michael Ludvig

Written by

AWS Ambassador ★ AWS Cloud Consultant at enterpriseIT in New Zealand

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade