Disk per tenant vs. a subdirectory per tenant
A subdirectory mount makes a directory the root of a mount, but the
credentials that allow it can mount the whole disk. POSIX permissions aren’t a security boundary between untrusted
tenants either. Use subdirectories to organize work within one tenant, such as a directory per agent, and use separate
disks between tenants. See Use a disk as your unit of isolation.
Provision a disk per tenant
Create the tenant’s disk from your backend when the tenant signs up, or the first time one of its agents runs. Disk names can use letters, digits,-, and _.
Scope credentials to the tenant
Archil has separate credentials for managing disks and for reaching a disk’s data. Keep the broad one on your backend and hand tenants only the narrow ones.- API keys are scoped to an organization and region and have full access to every disk in it. Keep them on your backend, never in a tenant’s sandbox or client.
- Disk tokens mount one disk. They can have a TTL or be one-time use. Store each tenant’s tokens with that tenant,
and revoke a token with
removeUser. See Token-based disk authorization. - IAM authorization lets an AWS IAM role or user mount one disk, so a tenant’s workers can mount with their own IAM role instead of a token. See IAM-based disk authorization.
- S3 credentials reach one disk over the S3 API and can expire, for example
disk.createS3Credentials({ nickname: "uploads", ttl: "24h" }). Use them for your app’s uploads and downloads for that tenant. Most AWS SDKs and AWS CLI v2 needAWS_REQUEST_CHECKSUM_CALCULATION=when_required; see Client configuration. - Share URLs let someone download a single file without credentials. They expire after 24 hours by default, and at most after 7 days. See Create Share URL.
Run each tenant’s agents against its own disk
In an Archil sandbox, mount only the tenant’s disk. Archil handles mount authentication, so the sandbox never sees a token, and each sandbox is a Firecracker microVM with its own Linux kernel.Scale to thousands of tenants
- Disks per region: Developer 1,000, Team 25,000, Enterprise unlimited. See Limits.
- Clients per disk: up to 5,000 connected clients on one tenant’s disk.
- Cost follows data, not disk count: storage is metered on the data each disk holds. Active storage counts only data in the high-speed layer, which stays active for up to an hour after its last access, so an idle tenant’s disk falls back to the lower archive rate (Archil-managed disks) or to just your bucket (disks synced to your own bucket). See Metering and Pricing & Billing.
- Organizations: use separate organizations for environments such as Dev and Production, or to group tenants. Several organizations can be billed under one contract; contact us to set that up.
Tenants that bring their own bucket
If a tenant wants its data in its own bucket, create that tenant’s disk with the bucket as its data source. For Amazon S3, the tenant adds a bucket policy that grants access only to Archil sessions tagged with that disk’sarchilSessionId. See Bucket resource policy.
If many tenant disks use one bucket that you own, a policy that matches your archilAccountId covers every current and
future disk in your organization without edits. The trade-off is that any disk in your organization can then reach the
whole bucket, so a per-tenant bucketPrefix organizes the data but doesn’t enforce isolation. See
Authorizing every disk in your organization.
To mount a bucket that already holds a tenant’s data, see Mount an existing bucket.
Offboard a tenant
Revoke the tenant’s tokens and S3 credentials, then delete its disk. Deleting a disk that uses Archil-managed storage removes its data. Deleting a disk that uses the tenant’s own bucket stops synchronization and leaves the objects in the bucket, under the tenant’s control.Related
- Best practices: accounts, disks, and credentials for production and multi-tenant workloads
- Authorization: every credential type and how to create it
- On archil.com: Isolated per-tenant storage for multi-tenant AI agent applications and Scaling a multi-tenant AI agent product to thousands of tenants