Backup to Amazon S3 Addon

I created a very simple Add-On which uploads your HA Backups to an Amazon S3 Bucket.
It uses the aws s3 sync command, bash only, and its fully configurable: hass-addons/DOCS.md at b7bd59934d98193175723923c39d8d97d5b687bd · thomasfr/hass-addons · GitHub

It does not run all the time in the background, you start it with an automation which syncs the backup folder (configurable) to your S3 Bucket (configurable of course).
Example of using the Addon with an Automation:

automation:
  # create a full backup
  - id: backup_create_full_backup
    alias: Create a full backup every day at 4am
    trigger:
      platform: time
      at: "04:00:00"
    action:
      service: hassio.backup_full
      data:
        # uses the 'now' object of the trigger to create a more user friendly name (e.g.: '202101010400_automated-backup')
        name: "{{as_timestamp(trigger.now)|timestamp_custom('%Y%m%d%H%M', true)}}_automated-backup"

  # Starts the addon 15 minutes after every hour to make sure it syncs all backups, also manual ones, as soon as possible
  - id: backup_upload_to_s3
    alias: Upload to S3
    trigger:
      platform: time_pattern
      # Matches every hour at 15 minutes past every hour
      minutes: 15
    action:
      service: hassio.addon_start
      data:
      addon: XXXXX_amazon-s3-backup

I am using it myself for more than 6 months without problems.

See GitHub - thomasfr/hass-addons for installation instructions

Would love to get Feedback or Feature Requests if you are missing something.

3 Likes

Hi Thomas- thanks for writing this! I’ve been moving more of my backups to S3, so this is perfect to have. I noticed one issue where it appears to loop continuously/keeps running the deletion portion in the background- based on the automation description, I don’t think this is expected behavior?

I opened an issue in the GitHub repository for this, thanks! :grinning_face_with_smiling_eyes:

1 Like

Hi @ThomasFr,

wonderful plugin of yours to off site backup. Unfortunately, I am unable to find your addon in the store.

I am fairly new to haas. Maybe you spot my mistake.

Many thanks in advance & kind regards
Mike

Will this also work for the IDrive E2 service? It have a S3 support with bucket as well.
Have a endpoint URL, Access key and secret key

I have started a fork here, I am able to use it with BackBlaze S3. It should work with any S3 provider.

The docs are not updated yet, but it works the same way as the original add-on. Just add GitHub - mcn18/hass-addons to your Add-On repositories.

3 Likes

Works nice! I have only 1 thing. It used a lot of CPU usage. Rest nice build!

And add: Watchdog. When service is down for some reason Watchdog will start service again.

Seems its loop all the time?

configuration:

> aws_access_key: My_Username
> aws_secret_access_key: My_Secret
> custom_endpoint: http://192.168.100.62:9010
> bucket_name: hassio
> bucket_region: ams
> delete_local_backups: true
> local_backups_to_keep: 3
[13:20:11] INFO: Starting S3 Backup...
[13:20:17] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:20:18] INFO: Finished S3 Backup.
[13:20:18] INFO: Starting S3 Backup...
[13:20:24] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:20:25] INFO: Finished S3 Backup.
[13:20:25] INFO: Starting S3 Backup...
[13:20:31] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:20:32] INFO: Finished S3 Backup.
[13:20:32] INFO: Starting S3 Backup...
[13:20:38] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:20:39] INFO: Finished S3 Backup.
[13:20:39] INFO: Starting S3 Backup...
[13:20:46] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:20:47] INFO: Finished S3 Backup.
[13:20:47] INFO: Starting S3 Backup...
[13:20:53] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:20:54] INFO: Finished S3 Backup.
[13:20:54] INFO: Starting S3 Backup...
[13:21:00] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:21:01] INFO: Finished S3 Backup.
[13:21:01] INFO: Starting S3 Backup...
[13:21:07] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:21:07] INFO: Finished S3 Backup.
[13:21:07] INFO: Starting S3 Backup...
[13:21:14] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:21:15] INFO: Finished S3 Backup.
[13:21:15] INFO: Starting S3 Backup...
[13:21:21] INFO: Will delete all the oldest local backups except the '3' newest ones.
[13:21:21] INFO: Finished S3 Backup.
[13:21:22] INFO: Starting S3 Backup...

Read the first post, Backup to Amazon S3 Addon It’s not meant to run all the time.

Hey, I just released a bugfix release v1.2.2 which fixes the continuous run of the backup addon.

Its not meant to run in the background continuously (as a daemon). Its meant to get started by an automation. You can see an example in the Documentation. So there is no need for enabling Watchdog.
This way it will save your cpu and memory resources during the day and just uses some while syncing your local backups to S3.

There is also a Feature Request to add support for other S3 API compatible providers. I would really appreciate help or even a Pull Request. If you are using any of the S3 compatible providers and can test it that would really help.

You have to add my repository as an Add-On Store: Open your Home Assistant instance and show the Supervisor add-on store.
Click the 3 dots in top right corner. Here is also the explanation how to do it: hass-addons/README.md at main · thomasfr/hass-addons · GitHub

Its now fixed in v1.2.2. Sorry for taking so long. Was hard to reprodoce, cause it was working all the time for me.

2 Likes

Hi!
The addon is not working for me anymore.

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[16:31:56] INFO: Starting Amazon S3 Backup...
[16:32:04] INFO: Will delete local backups except the '7' newest ones.
[16:32:04] INFO: Finished Amazon S3 Backup.
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Anyone any Ideas?

This add-on was exactly what I was looking for, but as reported by @Cholera it’s not working anymore.

I took this opportunity to made my own, to learn how add-on works.
You can find it here

1 Like