S3 Manager

repository·main·Indexed 21 days ago

https://github.com/cloudlena/s3manager

A Web GUI written in Go for managing S3 buckets from any provider through a browser interface. It supports configuration via environment variables, deployment via Docker and Kubernetes, and provides an API for bucket and object management, including support for SSE, IAM roles, and reverse proxy integration.

Tokens
1.7K
Snippets
5
Records
8
Agent score
27%

What's inside s3manager

  1. Configure S3 Manager behind an Nginx reverse proxy

    main

    When running multiple instances of S3 Manager behind a single Nginx reverse proxy (e.g., to serve different S3 accounts at different paths), use the ROOT_URL environment variable to match the Nginx location block.

    Example Scenario: If Nginx is configured with:

    • location /teamx/ proxying to s3manager-teamx
    • location /teamy/ proxying to s3manager-teamy

    Then:

    • The s3manager-teamx instance must have ROOT_URL=teamx.
    • The s3manager-teamy instance must have ROOT_URL=teamy.
        location /teamx/ {
            proxy_pass http://s3manager-teamx:8080/;
            auth_basic "teamx";
            auth_basic_user_file /conf/teamx-htpasswd;
        }
        location /teamy/ {
            proxy_pass http://s3manager-teamy:8080/;
            <other nginx settings>
        }
  2. Run S3 Manager using Docker

    main

    You can run S3 Manager as a container. You must provide your S3 credentials via environment variables.

    To run the image from Docker Hub, use the following command structure:

    docker run -p 8080:8080 -e 'ACCESS_KEY_ID=XXX' -e 'SECRET_ACCESS_KEY=xxx' cloudlena/s3manager
  3. Configure S3 Manager via environment variables

    main

    S3 Manager is configured using environment variables. Key settings include S3 connection details, authentication methods, and UI behavior.

    Connection & Authentication

    • ENDPOINT: S3 server endpoint (default: s3.amazonaws.com)
    • REGION: S3 server region (default: "")
    • ACCESS_KEY_ID: S3 access key ID (required if USE_IAM is false)
    • SECRET_ACCESS_KEY: S3 secret access key (required if USE_IAM is false)
    • USE_IAM: Use IAM role instead of key pair (default: false)
    • IAM_ENDPOINT: Endpoint for IAM role retrieving (can be blank for AWS)
    • SIGNATURE_TYPE: Signature type (default: V4; valid: V2, V4, V4Streaming, Anonymous)
    • USE_SSL: Use SSL (default: true)
    • SKIP_SSL_VERIFICATION: Skip SSL verification (default: false)

    UI & Feature Behavior

    • PORT: Port to listen on (default: 8080)
    • ALLOW_DELETE: Enable object deletion buttons (default: true)
    • FORCE_DOWNLOAD: Use response headers for downloading instead of opening in a new tab (default: true)
    • LIST_RECURSIVE: List all objects in buckets recursively (default: false)
    • BUCKET_NAME: Restrict view to a single named bucket
    • TZ: IANA timezone for Last Modified times (default: UTC, e.g., Europe/Berlin)
    • ROOT_URL: Root URL prefix for running behind a reverse proxy

    Encryption & Timeouts

    • SSE_TYPE: Server side encryption (default: blank; valid: SSE, KMS, SSE-C)
    • SSE_KEY: Key for KMS or SSE-C methods
    • TIMEOUT: Read/write timeout in seconds (default: 600)
  4. Run S3 Manager locally for testing with Docker Compose

    main

    The repository includes a docker-compose.yml file that spins up both an S3 service and the S3 Manager for local testing. Use the following command to start the environment:

    docker-compose up
  5. Configure S3 Manager via environment variables

    main

    The s3manager service is configured using indexed environment variables to manage multiple S3 instances. Each instance is identified by a numeric prefix (e.g., 1_, 2_).

    For each instance, you must provide the following variables:

    • {N}_NAME: A unique identifier for the S3 instance.
    • {N}_ENDPOINT: The network endpoint for the S3 service (e.g., s3:9000).
    • {N}_ACCESS_KEY_ID: The access key for the instance.
    • {N}_SECRET_ACCESS_KEY: The secret key for the instance.
    • {N}_USE_SSL: A boolean flag (true or false) indicating whether to use SSL/TLS.

    Note: The service exposes port 8080 by default.

    services:
      s3manager:
        ports:
          - 8080:8080
        environment:
          # Instance 1 configuration
          - 1_NAME=my-first-instance
          - 1_ENDPOINT=s3:9000
          - 1_ACCESS_KEY_ID=s3manager
          - 1_SECRET_ACCESS_KEY=s3manager
          - 1_USE_SSL=false
          # Instance 2 configuration
          - 2_NAME=my-second-instance
          - 2_ENDPOINT=s3-2:9000
          - 2_ACCESS_KEY_ID=s3manager2
          - 2_SECRET_ACCESS_KEY=s3manager2
          - 2_USE_SSL=false
  6. S3 Manager API Endpoints Reference

    main

    The S3 Manager provides a web interface and an API for managing multiple S3 instances. Most management endpoints require an {instance} parameter in the URL, which corresponds to the NAME provided in the instance configuration.

    Instance & Global Endpoints

    • GET /api/s3-instances: List all configured S3 instances.
    • GET /: Redirects to the first configured instance's buckets page.
    • GET /static/{path}: Serves static assets.

    Instance-Specific Endpoints

    All paths below follow the pattern /{instance}/...:

    Buckets

    • GET /{instance}/buckets: View all buckets for the instance.
    • GET /{instance}/buckets/: View contents of a specific bucket.
    • POST /{instance}/api/buckets: Create a new bucket.
    • DELETE /{instance}/api/buckets/{bucketName}: Delete a bucket (requires ALLOW_DELETE=true).
    • GET /{instance}/api/buckets/{bucketName}/policy: Get bucket policy.
    • PUT /{instance}/api/buckets/{bucketName}/policy: Set bucket policy.

    Objects

    • POST /{instance}/api/buckets/{bucketName}/objects: Create an object (supports SSE).
    • GET /{instance}/api/buckets/{bucketName}/objects/{objectName}/url: Generate a URL for an object.
    • GET /{instance}/api/buckets/{bucketName}/objects/{objectName}/public-access: Check public access status.
    • GET /{instance}/api/buckets/{bucketName}/objects/{objectName}: Get/Download an object.
    • DELETE /{instance}/api/buckets/{bucketName}/objects/{objectName}: Delete an object (requires ALLOW_DELETE=true).
    • POST /{instance}/api/buckets/{bucketName}/objects/bulk-delete: Bulk delete objects (requires ALLOW_DELETE=true).
    • POST /{instance}/api/buckets/{bucketName}/objects/bulk-download: Bulk download objects.