Storage

Connect applications

Storage works with the most used object storage command-line tools and SDKs. To connect, you need three things: the endpoint, the region and an access key created in the console.

Before you start

  1. Create a bucket from the Storage menu in the console.
  2. Create an access key for the application and keep its ID and secret. The secret is shown only once.
  3. If you limited the key to some networks, make sure the application connects from one of them.
SettingValue
Endpointhttps://armazem.zenifra.com
Regionbr-sp1
Addressingpath style

Keep the key in environment variables, never in code. In Zenifra projects, use the project environment variables.

ACCESS_KEY_ID=...
SECRET_ACCESS_KEY=...

AWS CLI

aws configure set aws_access_key_id "$ACCESS_KEY_ID" --profile zenifra
aws configure set aws_secret_access_key "$SECRET_ACCESS_KEY" --profile zenifra
aws configure set default.s3.addressing_style path

aws --profile zenifra --endpoint-url https://armazem.zenifra.com --region br-sp1 s3 ls
aws --profile zenifra --endpoint-url https://armazem.zenifra.com --region br-sp1 s3 cp ./photo.png s3://photos/2026/photo.png

JavaScript and TypeScript

npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
import { GetObjectCommand, PutObjectCommand, S3Client } from '@aws-sdk/client-s3'
import { getSignedUrl } from '@aws-sdk/s3-request-presigner'

const client = new S3Client({
  endpoint: 'https://armazem.zenifra.com',
  region: 'br-sp1',
  forcePathStyle: true,
  credentials: { accessKeyId: process.env.ACCESS_KEY_ID!, secretAccessKey: process.env.SECRET_ACCESS_KEY! },
})

await client.send(new PutObjectCommand({ Bucket: 'photos', Key: '2026/photo.png', Body: file, ContentType: 'image/png' }))

const link = await getSignedUrl(client, new GetObjectCommand({ Bucket: 'photos', Key: '2026/photo.png' }), { expiresIn: 3600 })

Python

pip install boto3
import os
import boto3
from botocore.config import Config

client = boto3.client(
    's3',
    endpoint_url='https://armazem.zenifra.com',
    region_name='br-sp1',
    aws_access_key_id=os.environ['ACCESS_KEY_ID'],
    aws_secret_access_key=os.environ['SECRET_ACCESS_KEY'],
    config=Config(s3={'addressing_style': 'path'}),
)

client.upload_file('backup.tar.gz', 'backups', '2026/backup.tar.gz')
link = client.generate_presigned_url('get_object', Params={'Bucket': 'backups', 'Key': '2026/backup.tar.gz'}, ExpiresIn=3600)

A signed link gives access to a single file for a limited time, without exposing the key. Use links to:

  • deliver a file to an end user;
  • receive an upload straight from the user's browser, without passing through your server;
  • share a file by email or chat.

To receive uploads straight from the browser, add a CORS rule to the bucket that allows your site's domain (for example, with PutBucketCors in the SDK). A link lasts at most 7 days. In the console, Copy link creates a 7-day download link.

Good practices

  • One key per application. You can revoke one without affecting the others.
  • Limit networks. A key restricted to the application's networks does not work if it leaks.
  • Retry on limits. Above the key's traffic limit, Storage refuses the request with SlowDown (HTTP 503). SDKs already retry with backoff; keep that on.
  • Upload large files in parts. SDKs split large uploads automatically. The limit is 20 GB per file.

Common errors

ErrorLikely cause
403 AccessDeniedrevoked key, network not in the key's list, read-only Storage or an operation that is not allowed, such as making a file public
403 SignatureDoesNotMatchwrong secret, machine clock out of sync or a changed signed link
404 NoSuchBucketthe bucket does not exist or the name is misspelled
503 SlowDownthe key's traffic limit; retry with backoff

Next steps

Last updated on

On this page