Although the application is fully operational, it is only exposed as a RESTful web service. You now deploy a small web page on Amazon S3, which is a great choice for hosting static web pages. This web page uses JavaScript to connect to the API and provide text-to-speech functionalities in a web page.
Download these files to your computer, use mouse right click and “Save Link As…”.
Note: Ensure that each file keeps the same filename, including the extension.
Edit your scripts.js file with a Text Editor, replacing YOUR_API_GATEWAY_ENDPOINT (on the first line) with the Invoke URL you copied earlier.
Expected output:
var API_ENDPOINT = "https://xxxxx.execute-api.us-west-2.amazonaws.com/Dev"
You now upload these files to an Amazon S3 bucket.
www-BUCKETBUCKET with the name of your audioposts bucketNote: Notice all of the individual options remain deselected. When deselecting all public access, you must then select the individual options that apply to your situation and security objectives. In a production environment, it is recommended to use the least permissive settings possible.
A warning box appears saying that: Turning off block all public access might result in this bucket and the objects within becoming public. AWS recommends that you turn on block all public access, unless public access is required for specific and verified use cases such as static website hosting.
Note: The files must be named: index.html, scripts.js and styles.css
On the bucket page, select the Permissions tab at the top.
Scroll down to the Bucket Policy section and choose the Edit button.
Paste this policy into the editor:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::www-BUCKET/*"
]
}
]
}
Replace www-BUCKET with the name of your www-audioposts bucket.
Choose Save changes.
WARNING: If you receive an error that Policy has invalid resource, confirm that you have edited the Resource line to match the name of your bucket.
Note: You can ignore the warning that This bucket has public access. This is intentional.
Finally, you activate static website hosting, which makes the bucket operate like a static website.
index.htmlindex.htmlindex.html file as error document.And that’s it! You can now check if the website is working.
Open a new web browser tab and paste the Endpoint URL that you just copied.
You should see a page that looks like this:

If you write something in the text area and choose Say it, the event is sent to your application. The application asynchronously converts the text into an audio file. Depending on the size of the text you provide, it can take a couple of seconds or a couple of minutes to convert it to an audio file.
To view the posts and their audio files, type the post ID or * in the Search box:

Play button to hear the audio.
Task Complete
You can now proceed to next task.