Skip to main content

JuiceFS S3 Gateway

From 4.9 and above, JuiceFS Client provides the juicefs gateway subcommand to enable an S3 compatible RESTful APIs for file system access. Currently clients like s3cmd, AWS CLI and MinIO Client and S3 SDK for various programming languages are supported for accessing JuiceFS.

Before deploying the S3 gateway, you need to authenticate against the Web Console using the auth command, this command will fetch the configuration file.

set credentials

S3 gateway is implemented using the open source MinIO code, so you'll have to provide some MinIO related variables:

export MINIO_ACCESS_KEY="admin"
export MINIO_SECRET_KEY="password"

Forgetting these variables will result in errors like MINIO_ROOT_USER should be specified as an environment variable with at least 3 characters`.

launch S3 gateway

juicefs gateway myjfs 127.0.0.1:8888

Expect the following output:

2023/03/21 20:15:49.945403 juicefs[97188] <INFO>: connected to 47.103.20.252:9308 [client.go:874]
2023/03/21 20:15:49.965411 juicefs[97188] <INFO>: Cache: /Users/herald/.juicefs/cache/jfs8 capacity: 102400 MB [disk_cache.go:747]
Endpoint: http://127.0.0.1:8888

Browser Access:
http://127.0.0.1:8888

Object API (Amazon S3 compatible):
Go: https://docs.min.io/docs/golang-client-quickstart-guide
Java: https://docs.min.io/docs/java-client-quickstart-guide
Python: https://docs.min.io/docs/python-client-quickstart-guide
JavaScript: https://docs.min.io/docs/javascript-client-quickstart-guide
.NET: https://docs.min.io/docs/dotnet-client-quickstart-guide

Assuming your server's public IP being 111.2.3.4 and you want to open up access to the gateway over the internet and bind to port 9000, you can adjust the startup command like this:

juicefs gateway myjfs 111.2.3.4:9000

Access Gateway

Once S3 Gateway is launched, you can directly access the URL you set in your browser, i.e., http://127.0.0.1:8888 in the example above. Open the file explorer for web, and enter the corresponding Access Key and Secret Key to login.

In addition, clients like AWS CLI and MinIO Client and S3 SDKs for various programming languages are also available for accessing S3 Gateway.