Clone
2
S3 Configuration
chrislusf edited this page 2025-12-14 13:54:08 -08:00

S3 Configuration Overview

SeaweedFS S3 gateway has two separate configuration systems for different purposes. Understanding the difference is crucial for proper setup.

Quick Reference

Option Purpose Use When
-s3.config / -config Basic S3 credentials (identities, access keys, actions) You need simple user authentication with access keys
-s3.iam.config / -iam.config Advanced IAM (STS, OIDC, policies, roles) You need OIDC integration, role-based access, or AWS IAM-style policies

Basic Credentials (-s3.config)

Use this for: Simple username/password style authentication with access keys.

Documentation: S3 Credentials

weed s3 -config=/path/to/s3.json -filer=localhost:8888
# OR
weed server -s3 -s3.config=/path/to/s3.json

Configuration Format

{
  "identities": [
    {
      "name": "admin_user",
      "credentials": [
        {
          "accessKey": "your_access_key",
          "secretKey": "your_secret_key"
        }
      ],
      "actions": ["Admin", "Read", "Write", "List", "Tagging"]
    },
    {
      "name": "readonly_user",
      "credentials": [
        {
          "accessKey": "readonly_key",
          "secretKey": "readonly_secret"
        }
      ],
      "actions": ["Read", "List"]
    }
  ]
}

Available Actions

Action Description
Admin Full access, create/delete buckets
Read Read objects
Write Write/upload objects
List List buckets and objects
Tagging Manage object tags
Read:bucket1 Read access to specific bucket
Write:bucket1 Write access to specific bucket

Advanced IAM (-s3.iam.config)

Use this for: Enterprise features like OIDC/Keycloak integration, STS (Security Token Service), IAM policies, and role-based access control.

Documentation: OIDC Integration

weed s3 -filer=localhost:8888 -iam.config=/path/to/iam.json
# OR
weed server -s3 -s3.iam.config=/path/to/iam.json

Configuration Format

{
  "sts": {
    "tokenDuration": "1h",
    "maxSessionLength": "12h",
    "issuer": "seaweedfs-sts",
    "signingKey": "base64-encoded-32-byte-key"
  },
  "providers": [
    {
      "name": "keycloak",
      "type": "oidc",
      "enabled": true,
      "config": {
        "issuer": "https://keycloak.example.com/realms/myrealm",
        "clientId": "seaweedfs-s3",
        "jwksUri": "https://keycloak.example.com/realms/myrealm/protocol/openid-connect/certs"
      }
    }
  ],
  "policies": [
    {
      "name": "ReadOnlyPolicy",
      "document": {
        "Version": "2012-10-17",
        "Statement": [
          { "Effect": "Allow", "Action": ["s3:Get*", "s3:List*"], "Resource": ["*"] }
        ]
      }
    }
  ],
  "roles": [
    {
      "roleName": "ReadOnlyRole",
      "roleArn": "arn:aws:iam::role/ReadOnlyRole",
      "attachedPolicies": ["ReadOnlyPolicy"],
      "trustPolicy": { ... }
    }
  ]
}

Key Components

Component Description
sts Security Token Service configuration for temporary credentials
providers OIDC identity providers (Keycloak, Okta, Auth0, etc.)
policies AWS IAM-style policy documents
roles IAM roles with trust policies for role assumption

Important

: The -s3.iam.config does NOT support the identities field. For basic user credentials, use -s3.config instead.


Using Both Together

You can use both configuration options together:

weed s3 \
  -config=/path/to/s3-credentials.json \
  -iam.config=/path/to/iam-advanced.json \
  -filer=localhost:8888

This allows:

  • Basic users to authenticate with access keys (from -s3.config)
  • OIDC users to authenticate with JWT tokens (from -s3.iam.config)

Common Mistakes

Wrong: Using identities in -s3.iam.config

# This will NOT load identities!
weed s3 -iam.config=/path/to/config.json

With config file:

{
  "identities": [...]  // This is IGNORED by -iam.config
}

Correct: Using identities in -s3.config

weed s3 -config=/path/to/config.json

With config file:

{
  "identities": [...]  // This works with -config
}

Configuration Methods Summary

Method Priority Auto-Reload Best For
-config file Highest SIGHUP Production static config
Filer storage Medium Yes Dynamic management
Admin UI Medium Yes Web-based management
Environment variables Fallback No Development/testing

See S3 Credentials for detailed information on each method.


Embedded IAM API

Starting with SeaweedFS 3.x, the IAM API is embedded in the S3 server by default. This allows managing users, access keys, and policies using AWS IAM CLI commands on the same endpoint as S3.

# Start S3 with embedded IAM (default)
weed s3 -filer=localhost:8888

# IAM and S3 use the same endpoint
aws --endpoint http://localhost:8333 iam create-user --user-name bob
aws --endpoint http://localhost:8333 s3 ls

Disabling Embedded IAM

If you don't need IAM API functionality, you can disable it:

weed s3 -iam=false -filer=localhost:8888

See Amazon IAM API for detailed IAM usage.