DEPRECATED: Please use the S3-Compatible integration from HACS instead. It works fine e.g. with Hetzner Object Storage and many other S3 clones.
A quick fork of the AWS S3 component by Tomáš Bedřich which is not restricted to AWS domains and therefore can be used with compatible S3 providers.
Hopefully short-lived since this repo will be archived as soon as Home Assistant implements support for compatible S3 providers out of the box.
cd config # where configuration.yaml lives
mkdir custom_components
cd custom_components
git clone https://github.com/svoop/generic_s3.git
ha core restart
Prefixes
In order to use Prefixes, you will need to enter a prefix when creating a new connection. Pre-existing connections cannot be changed to include a new prefix.
When entering a prefix, use the following syntax, making sure to include the trailing slash:
firstfolder/nextfolder/lastfolder/
For example, if you would like to use the location "backups/homeassistant/" within your bucket, the prefix in the setup pane would be:
backups/homeassistant/
S3 IAM Policy
In order to get IAM working with read/write to the location that you would like, without allowing access to any other folders within the bucket an example IAM policy is shown below:
This policy assumes the following information:
- A bucket with the name "myhomebackups"
- A prefix of "backups/homeassistant"
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::myhomebackups",
"Condition": {
"StringEquals": {
"s3:prefix": [
"",
"backups/",
"backups/homeassistant/"
]
}
}
},
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::myhomebackups",
"Condition": {
"StringLike": {
"s3:prefix": "backups/*",
"s3:prefix": "backups/homeassistant/*"
}
}
},
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": "arn:aws:s3:::myhomebackups/backups/homeassistant/*"
}
]
}