tldr; AWS Lambda to backup mysql database to S3
Although, incase working with Lambda, you would need to publish this to Private ECR, in case needed, latest can be pulled from: public.ecr.aws/letsdocoding/mysqlbackup-lambda:latest.
Following diagram illustrates the High Level Design of solution.
- Publish to your private ECR Repo
- Define the following ENV Variables to configure
S3_BUCKET
: Defines the target S3 BucketDB_HOST
: Defines the Database HostDB_NAME
: Defines the database nameDB_USER
: Defines the database userDB_PASS
: Defines the database password
- Configure the triggers and good to go
- Use Secrets manager to store credentials
- Iterate database to get all databases and dump all.
- Use multiple source to trigger database backups.