Your own bucket
A disk can keep its files in a bucket you own instead of Archil’s. Archil still keeps the data in use in its storage layer, and copies writes to your bucket in the background, where they’re ordinary objects any S3 tool can read without Archil. Destroying the disk leaves them there. Archil offers it on its paid plans.
Your bucket trusts Archil, no key needed
Section titled “Your bucket trusts Archil, no key needed”On S3, the bucket’s policy trusts Archil’s IAM role for your region, only on behalf of disks in your organization, so no access key exists anywhere.
A disk on an S3 bucket
Section titled “A disk on an S3 bucket”ArchilAWS.S3Disk declares the bucket policy and the disk together:
import * as AWS from "@alchemy.run/aws";import * as ArchilAWS from "@alchemy.run/archil/AWS";
export const Store = AWS.S3.Bucket("Store", {});export const Dataset = ArchilAWS.S3Disk("Dataset", { bucket: Store, prefix: "datasets/" });The disk’s files land under datasets/ in Store. Your Stack needs AWS.providers() next to Archil.providers().
Set your organization id in the profile
Section titled “Set your organization id in the profile”The policy is scoped to your Archil organization, so Alchemy needs its id. Enter it in your profile:
alchemy profile edit --add ArchilOr set ARCHIL_ORGANIZATION in CI. Find the id in the console.
Use another object store
Section titled “Use another object store”R2, Google Cloud Storage, Azure Blob and other S3-compatible stores take keys. Give them in storage on Archil.Disk:
export const Dataset = Archil.Disk("Dataset", { storage: { type: "r2", bucketName: "datasets", bucketEndpoint: "https://<account>.r2.cloudflarestorage.com", accessKeyId: Config.Redacted("R2_ACCESS_KEY_ID"), secretAccessKey: Config.Redacted("R2_SECRET_ACCESS_KEY"), },});Changing storage replaces the disk.
The bucket sees writes a little later
Section titled “The bucket sees writes a little later”Archil writes to the bucket after the write is durable in its own storage, so a tool reading the bucket directly sees a new file a little later than a client of the disk does. Read through the disk when you need the latest write.