In this step-by-step tutorial you will use the Amazon Polly for WordPress plugin to add text-to-speech capability to a WordPress installation. Amazon Polly is a service that uses advanced deep learning technologies to synthesize speech that sounds like a human voice, enabling you to create applications that talk, and build entirely new categories of speech-enabled products.

The Amazon Polly for WordPress plugin example demostrates how content creators can easily add text-to-speech capabilities to any written content. With more and more search happening by voice, it’s essential to have more of your website’s content in audio formats. By adding voice capabilities, visitors to your websites can consume your content via new channels such as inline audio players and podcast applications.

You can add the Amazon Polly for WordPress plugin to a WordPress installation that is set up on an EC2 instance, LightSail or hosted elsewhere. There are numerous options to create a WordPress installation on AWS. If you need a WordPress site on AWS, you can create one easily using LightSail, on EC2 using the Launch a WordPress Website 10-minute tutorial, or with a more advanced tutorial at Build a Wordpress Website project.

This tutorial requires an AWS account

Open the AWS Management Console and you can keep this step-by-step guide open. When the screen loads, enter your user name and password to get started. Then type an IAM in the search box, and press Enter to open the dashboard.

If you are hosting your WordPress site on EC2, use the EC2 instructions below.

If you are hosting your WordPress site on LightSail or not on AWS, use the LightSail instructions below.

EC2

In this step, you will create an IAM policy, which is a document that defines permissions. Once you attach the IAM policy to an IAM EC2 role, and can assign this role to your EC2 based WordPress server.

a. Select Policies on the left-hand side and then Create Policy.

(click to zoom)

b. On the Create Policy page select JSON tab in the table. Paste below code into the editor, and then select the Review policy button.

j. In the next window, under IAM role field select PollyForWordPressRole role, which you have created before. Then click Apply.

(click to zoom)

LightSail/Non-AWS Hosting

In this step you will create an IAM user with special permissions, which will provide access to AWS services required for the plugin to work. The IAM user you create will receive AWS credentials, which are known as AWS Access Key and AWS Secret Key. You will use these keys in the plugin configuration page.

a. Select Policies on the left-hand side and then Create Policy.

(click to zoom)

b. On the Create Policy page select JSON tab in the table. Paste below code into the editor, and then select the Review policy button.

c. On the Review policy page in Name field, type: PollyForWordPressPolicy and Create policy.

(click to zoom)

d. On the left-hand side of the screen, select Users, and Add User.

(click to zoom)

e. On the first step of the wizard, provide the name of the new IAM User: AmazonPollyForWordPress, select Programmatic access and move to the next step of the wizard.

(click to zoom)

f. On the next step of the wizard you will need to select the policy which you have created in ‘Step 1-c’. Select Attach existing policies directly tab and from the list of policies choose PollyForWordPressPolicy.

(click to zoom)

g. On the third step of the wizard review the changes, select Create User and move to the final step.

(click to zoom)

h. On the last step of the wizard you will need to note down the IAM credentials for the new user. You can choose to Download .csv, or copy the Access Key Id and Secret Access Key manually. The information is required to configure the Amazon Polly for Wordpress plugin later.

EC2

Congratulations, the plugin is installed! The plugin will work without additional configuration, but there are many useful settings. For example, you can select different Amazon Polly voices for the audio output, or enable podcast capabilities through Amazon Pollycast feeds. Let's see how to get to the plugin configuration page.

Select Settings on the left-hand side and then Amazon Polly. You can modify the plugin configuration in this step, for example you could change the voice (Voice Name) which is used to create audio file. Notice that you don’t need to provide IAM credentials – it’s because you have attached IAM role to EC2 instance on which WordPress is installed.

(click to zoom)

LightSail/Non-AWS Hosting

Congratulations, the plugin is installed! The plugin will work without additional configuration but there are many useful settings. For example, you can select different Amazon Polly voices for the audio output, or enable podcast capabilities through Amazon Pollycast feeds. Let's see how to get to the plugin configuration page!

a. Select Settings on the left-hand side and choose Amazon Polly. You will need to provide your AWS credentials, so that the plugin would have access to AWS services which it uses. In AWS Access Key and AWS Secret Key fields, enter the credentials which you downloaded in the .csv in Step 1-j of this tutorial. Click on Save to the save the changes.

(click to zoom)

b. Now you should see that other settings are available, and you can change them. For example, under Polly Voice Name, you can choose from a wide selection of voices to articulate the audio content.

At this stage, everything is done and your new web content will be made available to your readers in audio format. Now you can create a new blog post and see if you are able to hear the audio content.

a. Select Posts on the left-hand side and then Add New to open wizard for creating new post. Write your own blog post with title and content. Still on this same screen, click onthe Enable Amazon Polly checkbox. And then select Publish to save the new post.

(click to zoom)

b. Open your WordPress site. You should now see a new post with an embedded player. Click the Play button and listen to the voiced article.

Note: In addition to the HTML embedded player available on WordPress site, you can also enable podcast capabilities via the Amazon Pollycast feeds. These feeds are RSS 2.0 compliant and provide necessary XML data for aggregation by popular Podcast mobile applications and podcast directories such as iTunes. Read the AWS AI Blog for more details!

You can now easily voice your WordPress content with the Amazon Polly plugin. To do something a bit more dynamic, use the Amazon Polly API to access the full set of features such as custom pronunciation, lip-syncing and text highlighting. With dozens of natural sounding voices across a variety of languages, you can select the ideal voice and build speech-enabled applications that work in many different countries.