Blogs website
Contact details | [email protected]
This is not a production ready code but more of an advanced POC.
I use it to convert my blog's text to audio for accessibility reasons.
It uploads any text file in the /text folder to S3, turns them into .mp3 files and sends them back to an email address.
The email address is hardcoded in the service/logic/email.py file and can be changed.
Here's a deep dive into the design: https://www.ranthebuilder.cloud/post/serverless-empowers-accessibility-convert-text-to-speech-with-amazon-polly
Important: make sure you enable SES to send emails to the email address you choose https://docs.aws.amazon.com/ses/latest/dg/creating-identities.html
I was inspired to design a solution for myself after seeing this excellent YouTube video by Johannes Koch and Jimmy Dahlqvist.
For the service design and further information checkout my blog post here.
Flow of events:
That's definitely an improvement, but this was just a quick POC to automate my personal needs and provide a code example for a blog post.
In a production code, you should use a step function state machine that waits until the task is completed.
For my needs, I want to upload the mp3 file to my website and remove it from my personal AWS account. You can alter the behavior as you wish.
poetry config --local virtualenvs.in-project true
so all dependencies are installed in the project '.venv' folder.make dev
poetry install
Create a cloudformation stack by running make deploy
.
CDK destroy can be run with make destroy
.
Run make pr
. This command will run all the required checks, pre commit hooks, linters, code formats, flake8 and tests, so you can be sure GitHub's pipeline will pass.
The command auto fixes errors in the code for you.
If there's an error in the pre-commit stage, it gets auto fixed. However, are required to run make pr
again so it continues to the next stages.
Be sure to commit all the changes that make pr
does for you.
CDK requires a requirements.txt in order to create a zip file with the Lambda layer dependencies. It's based on the project's poetry.lock file.
``make deploy` command will generate it automatically for you.
This file is used during GitHub CI to install all the required Python libraries without using poetry.
File contents are created out of the Pipfile.lock.
make deploy
make deps
commands generate it automatically.
Put a text file (.txt) into the /text folder. Deploy the CDK stack with 'make deploy' command.
It will be uploaded into an S3 bucket and turned into an mp3 file sent to you via email.
The email address is hardcoded and can be found at service/logic/email.py file.
When you add a new file: you can either upload to directly to the bucket or add them to the /text folder and run 'make deploy'.
Code contributions are welcomed. Read this guide.
Read our code of conduct here.
This library is licensed under the MIT License. See the LICENSE file.