Storage Credentials
Access your object storage with S3-compatible credentials and the AWS SDK.
Each bucket gets its own set of S3 credentials, stored as a Kubernetes secret in your VPC.
Credential keys
| Key | Description |
|---|---|
ACCESS_KEY | S3 access key ID |
SECRET_KEY | S3 secret access key |
ENDPOINT | S3 endpoint URL |
REGION | Storage region |
You can view these in the bucket's Credentials tab or reference them as environment variables in your services.
Using the AWS SDK
SMLL storage is S3-compatible, so you can use the standard AWS SDK with a custom endpoint.
Node.js
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
const s3 = new S3Client({
endpoint: process.env.S3_ENDPOINT,
region: process.env.S3_REGION,
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY,
secretAccessKey: process.env.S3_SECRET_KEY,
},
forcePathStyle: true,
});
await s3.send(new PutObjectCommand({
Bucket: "my-bucket",
Key: "uploads/photo.jpg",
Body: fileBuffer,
}));Python
import boto3
s3 = boto3.client(
"s3",
endpoint_url=os.environ["S3_ENDPOINT"],
region_name=os.environ["S3_REGION"],
aws_access_key_id=os.environ["S3_ACCESS_KEY"],
aws_secret_access_key=os.environ["S3_SECRET_KEY"],
)
s3.upload_file("photo.jpg", "my-bucket", "uploads/photo.jpg")Go
cfg, _ := config.LoadDefaultConfig(ctx,
config.WithRegion(os.Getenv("S3_REGION")),
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(
os.Getenv("S3_ACCESS_KEY"),
os.Getenv("S3_SECRET_KEY"),
"",
)),
)
client := s3.NewFromConfig(cfg, func(o *s3.Options) {
o.BaseEndpoint = aws.String(os.Getenv("S3_ENDPOINT"))
o.UsePathStyle = true
})Linking to services
To use storage credentials in a service:
- Go to your service's Environment Variables tab
- Link each credential key from the bucket's secret
- Redeploy
Your service can then use the standard S3 SDK with these credentials.
Supported S3 operations
The following S3 API actions are supported:
s3:GetObject— download objectss3:PutObject— upload objectss3:DeleteObject— delete objectss3:ListBucket— list objects in a buckets3:GetBucketLocation— get bucket region