Introduction
In this step-by-step tutorial you will use the AWS Plugin for WordPress 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 AWS Plugin for WordPress example demonstrates 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 AWS Plugin for WordPress 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.
Cost to Complete
Free Tier
Services Used
Implementation
-
Create AWS Permissions for WordPress
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
-
Lightsail/Non-AWS Hosting
-
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. On the left-hand side of the screen, select Roles and then Create Role.
b. On the Create Role page, select AWS Service on the top. From the services list select EC2. From the Select your use case list, select EC2. Select Next: Permissions to continue to the next page.
c. On the Attach permissions policies page, in the search box type AWSForWordPressPluginPolicy, Select the checkbox next to the policy from the list and then select Next Review.
d. On the Review page, in the Rule name field, write PollyForWordPressRole, and then select Create role to continue.
e. Now you will assign the PollyForWordPressRole role to your WordPress EC2 instance. Select Services tab on the top of the page and then EC2 service.
f. Select Instances on the left-hand side, and choose your EC2 WordPress instance. From the Actions menu choose Instance Settings > Attach/Replace IAM Role.
g. In the next window, under IAM role field select PollyForWordPressRole role, which you have created before. Then click Apply.
-
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. On the left-hand side of the screen, select Users, and Add User.
b. 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.
c. On the Attach permissions policies page, in the search box type AWSForWordPressPluginPolicy, Select the checkbox next to the policy from the list and then select Next Review.
d. On the third step of the wizard review the changes, select Create User and move to the final step.
e. 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 AWS Plugin for WordPress later.
-
-
Install AWS Plugin for WordPress
In this step, you will download and install the Amazon Polly plugin for WordPress.
a. Open your WordPress admin page and log in.
b. Select Plugins on the left-hand side, and Add New.
c. On Add Plugins Page, write AWS for WordPress in search box and press enter. Choose the AWS plugin and select Install Now.
d. Select Activate to activate the plugin.
-
Configure AWS Plugin for WordPress
If you are hosting your WordPress site on EC2, use the EC2 instructions below.
If you are hosting your WordPress site on Lightsail (or elsewhere outside of AWS), choose the Lightsail instructions below.
-
EC2
-
Lightsail/Non-AWS Hosting
-
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 AWS on the left-hand side and choose Text-To-Speech. On this page enable text-to-speech functionality and click on Save Changes. Now you should see that other settings are available, and you can change them also. For example, under Voice Name, you can choose from a wide selection of voices to articulate the audio content.
-
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 AWS on the left-hand side and choose General. 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 previous steps of this tutorial. Click on Save Changes to the save the changes.
b. Select AWS on the left-hand side and choose Text-To-Speech. On this page enable text-to-speech functionality and click on Save Changes. Now you should see that other settings are available, and you can change them also. For example, under Voice Name, you can choose from a wide selection of voices to articulate the audio content.
-
-
Test Speech-to-Text on WordPress
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 on the Enable Amazon Polly checkbox. And then select Publish to save the new post.
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!
Congratulations!
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.