Skip to content

Config.yml

s3m needs a configuration file to read the S3 credentials, it will search by default in ~/.config/s3m/config.yml

The format of the config.yml file is:

yaml
---
hosts:
  provider_name:
    region: <region>
    endpoint: <endpoint>
    access_key: <access_key>
    secret_key: <secret_key>

for AWS normally you will use the region for other providers the endpoint

Examples

yaml
---
hosts:
  aws:
    region: eu-central-2
    access_key: AKIAZYSYPEXAMPLE
    secret_key: dX8IEdhpIuzaFf3lexample

  public:
    region: eu-east-2

  cloudflare:
    endpoint: 31675149903f5514779b45.r2.cloudflarestorage.com
    access_key: ACCESSKEY
    secret_key: SECRETKEY

  backblaze:
    endpoint: s3.us-west-001.backblazeb2.com
    access_key: ACCESSKEY
    secret_key: SECRETKEY

  backup:
    region: us-east-2
    access_key: ACCESSKEY
    secret_key: SECRETKEY

  yourprovider:
    endpoint: 9bb88c705bc0c7b4b7272aef77e77294.ds11s.provider.tld
    access_key: B6A937A9F1AA83A46Z10EXAMPLE
    secret_key: rNy3VViELdUdLVAA5Yt5RXpexample

INFO

If you are not using AWS and have no region use instead the provided endpoint

TIP

For Cloudflare R2 check https://developers.cloudflare.com/r2/api/s3/tokens/ to obtain the access and secret key

From the example, to save a file to the defined host backup:

sh
s3m /path/to/your/file backup/backups/test.txt
                        |     |      |
                        |     |      text.txt will be the name of the file
                        |     Bucket name: backups
                        backup: defined in config.yml, uses AWS in region us-east-2

The bucket backups should exist and the provided credentials should have rights to PUT objects

AWS policy

Example of an AWS IAM user policy to allow all actions to specific bucket:

json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::mybucket/*",
                "arn:aws:s3:::mybucket"
            ]
        }
    ]
}

show

To show your configured endpoints use command show:

sh
s3m show -h
Show available hosts from the config file

Usage: s3m show

Options:
  -h, --help  Print help