This app allows you to convert any content, from a text file to a publicly available RSS content into audio files, so you can listen to them on your mobile device instead of reading them.
- AWS account
- text file or RSS feed
- Amazon CloudWatch periodically triggers a function hosted using AWS Lambda.
- The function checks for new content on the selected RSS feed.
- When any new text content is available, it is retrieved, converted into lifelike speech using Amazon Polly, and stored as a set of audio files in a chosen S3 bucket.
- The same S3 bucket that hosts podcast.xml can be pointed to by any Podcast application (like iTunes), in order to play the audio content.
- Login to your AWS account.
- Create a new S3 bucket that will be used to store synthesized audio.
-
Go to the bucket properties->Permissions->Add bucket policy and paste the following policy:
{ "Version": "2012-10-17", "Statement": [{ "Sid": "AddPerm", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::YOUR_BUCKET_NAME/*" }]}
Make sure to substitute YOUR_BUCKET_NAME with an arbitrary name, keeping in mind that it has to be globally unique. Save the policy.
-
Expand the "Static Website Hosting" section in the bucket properties, choose "Enable website hosting", type "podcast.xml" in the "Index Document" field, and save the settings.
-
- Create a new Lambda function.
- Choose "Python 3.11" as runtime and "hello-world-python" as a blueprint.
- Skip triggers (just click "Next").
- Choose an arbitrary name for your function, change "Code entry type" to "Upload a .ZIP file", and upload dist/package.zip from this repository.
- Choose "Create a custom role" in the "Role" field, which will open a new tab.
-
In the newly opened tab, change "IAM Role" to "Create a new IAM Role", and choose an arbitrary name for the role.
-
Expand "View Policy Document", click the "Edit" link, and paste the following content into the text area:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "polly:SynthesizeSpeech", "s3:ListBucket", "s3:PutObject" ], "Resource": "*" } ] }
-
Click the "Allow" button at the bottom of the page, which will close the tab and get you back to the Lambda function settings.
-
- Change the Timeout to 5 min 0 seconds.
- Click "Next", review the settings, and click "Create function".
- Optional check to prove that the new function works as expected:
-
Click "Test" at the top of the page.
-
Use the following JSON document as test even input:
{ "rss": "http://feeds.feedburner.com/AmazonWebServicesBlog", "bucket": "YOUR_BUCKET_NAME" }
Make sure to substitute YOUR_BUCKET_NAME, and feel free to change rss into any RSS URL.
-
Click "Save and test" and wait until the function is finished. Keep in mind that it may take a while to retrieve, convert and store the content.
-
Go back to your newly created S3 bucket to see if it contains any new content.
-
- Go to Amazon CloudWatch, which will be used to periodically trigger your lambda function.
-
Go to "Events" and click "Create rule".
-
Select "Schedule" in "Event selector".
-
In the "Targets" section, choose "Lambda function", and then choose the newly created function. Expand "Configure input", choose "Constant (JSON text)", use the following JSON document:
{ "rss": "http://feeds.feedburner.com/AmazonWebServicesBlog", "bucket": "YOUR_BUCKET_NAME" }
That's the same JSON that you used before, to test your function (unless you were brave enough to skip that step). Again, make sure to substitute YOUR_BUCKET_NAME and choose your favorite RSS URL.
-
- Click configure details.
- Choose an arbitrary name and click "Create rule".
- Go back to your S3 bucket, click on the podcast.xml file that was previously created there, and open "Properties".
- Copy link and use it in any Podcast player (like iTunes or any Podcast app in Android). Optionally, use any URL shortener (like bit.ly) to create a short version of the link.
That's it! Your podcast is ready. Use it on your own, or share the URL with your friends. Optionally publish it as an audio version of your own blog (if you are the content owner).