Skip to content

Commit 743dbad

Browse files
committed
S3-compatibility with AWS Token
1 parent 48c6a5c commit 743dbad

File tree

6 files changed

+793
-21
lines changed

6 files changed

+793
-21
lines changed

README.md

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,60 @@ docker-compose up -d
6868

6969
### Using AWS CLI
7070

71+
Fula supports **AWS Signature V4** authentication, enabling full compatibility with standard S3 tools. Embed your JWT token in the access key with a `JWT:` prefix:
72+
7173
```bash
72-
# Configure endpoint
73-
export AWS_ENDPOINT_URL=http://localhost:9000
74+
# Configure credentials (~/.aws/credentials)
75+
cat >> ~/.aws/credentials << EOF
76+
[fula]
77+
aws_access_key_id = JWT:your-jwt-token-here
78+
aws_secret_access_key = not-used
79+
EOF
80+
81+
# Use AWS CLI with Fula gateway
82+
aws s3 mb s3://my-bucket --endpoint-url http://localhost:9000 --profile fula
83+
aws s3 cp file.txt s3://my-bucket/ --endpoint-url http://localhost:9000 --profile fula
84+
aws s3 ls s3://my-bucket/ --endpoint-url http://localhost:9000 --profile fula
85+
```
7486

75-
# Create a bucket
76-
aws s3 mb s3://my-bucket
87+
### Using Python (boto3)
7788

78-
# Upload a file
79-
aws s3 cp file.txt s3://my-bucket/
89+
```python
90+
import boto3
8091

81-
# List objects
82-
aws s3 ls s3://my-bucket/
92+
# Configure with JWT embedded in access key
93+
s3 = boto3.client('s3',
94+
endpoint_url='http://localhost:9000',
95+
aws_access_key_id=f'JWT:{jwt_token}',
96+
aws_secret_access_key='not-used',
97+
region_name='us-east-1'
98+
)
99+
100+
# Use S3 API normally
101+
s3.create_bucket(Bucket='my-bucket')
102+
s3.put_object(Bucket='my-bucket', Key='hello.txt', Body=b'Hello World!')
103+
```
83104

84-
# Download a file
85-
aws s3 cp s3://my-bucket/file.txt .
105+
### Using JavaScript (AWS SDK)
106+
107+
```javascript
108+
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
109+
110+
const s3 = new S3Client({
111+
endpoint: "http://localhost:9000",
112+
region: "us-east-1",
113+
forcePathStyle: true,
114+
credentials: {
115+
accessKeyId: `JWT:${jwtToken}`,
116+
secretAccessKey: "not-used"
117+
}
118+
});
119+
120+
await s3.send(new PutObjectCommand({
121+
Bucket: "my-bucket",
122+
Key: "hello.txt",
123+
Body: "Hello World!"
124+
}));
86125
```
87126

88127
### Using the Rust Client SDK

0 commit comments

Comments
 (0)