wzyboy / bucket3

Simple image hosting service that implements browser-based uploads to Amazon S3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bucket3

bucket3 is a simple image hosting service that implements browser-based uploads to Amazon S3. Images are uploaded directly to Amazon's server without proxying through bucket3 service first.

The S3 object key is derived from the SHA-256 digest of the file and is guaranteed to be unique. As such, new uploads won't overwrite previous files.

The service is dead-simple with no database and no built-in authentication. It is not recommended to expose the service to the general public without any authentication layer.

screenshot

Prerequisites

  • Create an S3 bucket example-bucket.
  • Put a domain example.org in front of the bucket (e.g. with CloudFront) so that https://example.org/foo.png returns foo.png in the bucket.

Setup

# Install the package
pipx install git+https://github.com/wzyboy/bucket3

# Configure the web server
export BUCKET3_DOMAIN=example.org
export BUCKET3_BUCKET=example-bucket

# Configure AWS credentials if needed.
# IAM permissions required: s3:GetObject + s3:PutObject
# https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
#export AWS_ACCESS_KEY_ID=AKIA...
#export AWS_SECRET_ACCESS_KEY=...

# Start the web server (localhost:5333)
bucket3-web

It is also possible to use bucket3 command to upload via CLI without starting the web server.

Special Thanks

Most of the frontend code is written by ChatGPT.

About

Simple image hosting service that implements browser-based uploads to Amazon S3.


Languages

Language:Python 50.9%Language:JavaScript 29.8%Language:CSS 13.3%Language:HTML 6.0%