Docs

Authentication

Every request to the chili S3 API is signed with AWS Signature Version 4 (SigV4). AWS SDKs, the AWS CLI and most tools do this automatically. You only provide the endpoint, region, access key and secret key. This page explains what happens and what to watch for when you sign requests yourself or create pre-signed URLs.

Overview

Topic

Value on chili

Note

Signing method

AWS Signature Version 4

Do not use Signature Version 2

Region

ch-east

Applies to both endpoints

Service

s3

Part of the credential scope

Protocol

HTTPS, port 443

Plain HTTP is refused

Addressing

Path style

Bucket name in the path, not in the hostname

Access keys

IAM users in the chili Console

At most two keys per user

Clock skew

At most 15 minutes

Otherwise RequestTimeTooSkewed

Access keys

The access key and secret key belong to an IAM user. You create both in the chili Console under IAM & object access. The secret is only visible right after it is created; store it in your password manager or secret store straight away.

What a key may do is defined by the IAM user's policies. A new user may do nothing until you assign a policy. Details in Access control.

The secret key is never sent. The client uses it to compute a signature over the request, and chili checks that signature.

Signature Version 4

A signed request carries an Authorization header with this pattern:

Authorization: AWS4-HMAC-SHA256
  Credential=<ACCESS_KEY>/20261123/ch-east/s3/aws4_request,
  SignedHeaders=host;x-amz-content-sha256;x-amz-date,
  Signature=<SIGNATURE>

Part

Meaning

Credential

Access key and credential scope: date (YYYYMMDD), region ch-east, service s3, aws4_request

SignedHeaders

Headers included in the signature; host is always included

Signature

HMAC-SHA256 over the canonical request, derived from the secret key

x-amz-date

Request time in the format 20261123T091500Z (UTC)

x-amz-content-sha256

SHA-256 of the request body, UNSIGNED-PAYLOAD, or a STREAMING-... value for chunked uploads

If the signature contains a region other than ch-east, such as us-east-1, chili rejects the request with SignatureDoesNotMatch or AuthorizationHeaderMalformed. Always set the region explicitly.

Signature Version 2

Do not use Signature Version 2. Older tools and libraries sometimes still use it by default. Switch them to SigV4 (often called s3v4 or AWS4-HMAC-SHA256). A tool that only supports SigV2 is not suitable for chili.

Addressing: path style

chili addresses buckets in path style. The bucket name goes into the path:

Path style:                 https://s3-ch-east.chilistorage.com/my-bucket/report.pdf
Virtual-hosted style:       https://my-bucket.s3-ch-east.chilistorage.com/report.pdf

All examples in these docs use path style. If a tool reports DNS or TLS errors with virtual-hosted style, switch to path style. Depending on the tool, the option is called "path style", "force path style" or s3ForcePathStyle.

Virtual-hosted style is possible in principle, but it is not set up by default. If your application requires virtual-hosted style, check with chili support how to enable it for your account and which hostname applies.

Example: AWS CLI and boto3

The AWS CLI signs automatically. Set region and endpoint in the configuration or per command:

aws configure set region ch-east
aws configure set request_checksum_calculation when_required
aws configure set response_checksum_validation when_required
aws configure set default.s3.addressing_style path

aws s3api list-buckets --endpoint-url https://s3-ch-east.chilistorage.com

In boto3, set the signature version and addressing style with Config:

import boto3
from botocore.config import Config

s3 = boto3.client(
    "s3",
    endpoint_url="https://s3-ch-east.chilistorage.com",
    region_name="ch-east",
    aws_access_key_id="<ACCESS_KEY>",
    aws_secret_access_key="<SECRET_KEY>",
    config=Config(
        signature_version="s3v4",
        s3={"addressing_style": "path"},
        request_checksum_calculation="when_required",
        response_checksum_validation="when_required",
    ),
)

Pre-signed URLs

A pre-signed URL carries the signature as query parameters. Anyone with the URL can run exactly one operation on exactly one object until it expires, without their own access keys. Typical uses are downloads for customers or uploads from a browser.

Parameter

Meaning

X-Amz-Algorithm

Always AWS4-HMAC-SHA256

X-Amz-Credential

Access key and credential scope with ch-east

X-Amz-Date

Time of signing (UTC)

X-Amz-Expires

Validity in seconds, at most 604800 (7 days)

X-Amz-SignedHeaders

Signed headers, usually only host

X-Amz-Signature

The signature

The URL has at most the permissions of the IAM user whose key created it. If you delete the key, all URLs created with it stop working.

aws s3 presign creates a URL for GetObject, here valid for one hour:

aws s3 presign s3://my-bucket/report.pdf \
  --expires-in 3600 \
  --region ch-east \
  --endpoint-url https://s3-ch-east.chilistorage.com

Download and upload with boto3

With boto3 you can create URLs for GetObject and PutObject. Use the client from the example above:

# Download, valid for 1 hour
url_get = s3.generate_presigned_url(
    "get_object",
    Params={"Bucket": "my-bucket", "Key": "report.pdf"},
    ExpiresIn=3600,
)

# Upload, valid for 15 minutes
url_put = s3.generate_presigned_url(
    "put_object",
    Params={"Bucket": "my-bucket", "Key": "upload/scan.pdf", "ContentType": "application/pdf"},
    ExpiresIn=900,
)

The upload is then a plain HTTP PUT. If you set ContentType when signing, the upload must send the same Content-Type:

curl -X PUT -H "Content-Type: application/pdf" --upload-file scan.pdf "<URL_PUT>"

Uploads from a browser also need a CORS configuration on the bucket, see Access & CORS.

Clock skew (RequestTimeTooSkewed)

The signature contains a timestamp. If the client clock differs from server time by more than 15 minutes, chili rejects the request with HTTP 403 and the code RequestTimeTooSkewed. This mostly affects virtual machines, NAS systems and containers without time synchronisation.

<Error>
  <Code>RequestTimeTooSkewed</Code>
  <Message>The difference between the request time and the server's time is too large.</Message>
</Error>

Synchronise the clock via NTP. For pre-signed URLs the time of signing counts: a URL created on a machine with a wrong clock can be expired at once or not yet valid.

Common errors

Error code

Cause

Fix

SignatureDoesNotMatch

Wrong secret key, wrong region or modified request

Check the secret and region ch-east

AuthorizationHeaderMalformed

Region in the credential scope is not ch-east

Set the region in the tool to ch-east

InvalidAccessKeyId

Access key unknown or deleted

Check the key in the Console

RequestTimeTooSkewed

Client clock off by more than 15 minutes

Synchronise time via NTP

AccessDenied

Signature valid, but the policy does not allow the action

Check the IAM user's policy

More codes in Error codes.

Next