Charmed MySQL K8s How-to - Configure S3 for AWS

Note: All commands are written for juju >= v.3.0

If you are using an earlier version, check the Juju 3.0 Release Notes.

Configure S3 for AWS

Charmed MySQL K8s backup can be stored on any S3 compatible storage. The S3 access and configurations are managed with the s3-integrator charm. Deploy and configure the s3-integrator charm for AWS S3 (click here to backup on Ceph via RadosGW):

juju deploy s3-integrator
juju run s3-integrator/leader sync-s3-credentials access-key=<access-key-here> secret-key=<secret-key-here>
juju config s3-integrator \
    endpoint="https://s3.amazonaws.com" \
    bucket="mysql-test-bucket-1" \
    path="/mysql-k8s-test" \
    region="us-west-2"

The amazon S3 endpoint must be specified as s3.<region>.amazonaws.com within the first 24 hours of creating the bucket. For older buckets, the endpoint s3.amazonaws.com can be used.

See this post for more information.

To pass these configurations to Charmed MySQL, relate the two applications:

juju integrate s3-integrator mysql-k8s

You can create/list/restore backups now:

juju run mysql-k8s/leader list-backups
juju run mysql-k8s/leader create-backup
juju run mysql-k8s/leader list-backups
juju run mysql-k8s/leader restore backup-id=<backup-id-here>

You can also update your S3 configuration options after relating, using:

juju config s3-integrator <option>=<value>

The s3-integrator charm accepts many configurations - enter whatever configurations are necessary for your S3 storage.

Thanks for the guide @deusebio! A few notes after I tried using the s3 integrator for backups and replications:

  1. run-action has been replaced with just run, perhaps is a good idea to update the commands in the guide to have a simple copy/paste experience.
  2. The above also applies for the --wait
  3. The juju config s3-integrator endpoint="https://s3.amazonaws.com" \ command could be misleading as the endpoint can be anything, but in reality the command only works with https://s3.<region-name>.amazonaws.com. May I suggest to update the command to make it more generic?
1 Like

Dear @dnplas , thank you for the feedback. You are absolutely right and all above already mentioned on MySQL VM and significantly improved in PostgreSQL docs. However MySQL K8s required the same updates, but had not enough love. CC: @avgomes

I have copied necessary bits from MySQL VM to MySQL K8s. Tnx!

1 Like