Create & connect Storage
1. Create the resource
Section titled “1. Create the resource”Choose a globally unique bucket name. Comwit uses it exactly and does not add a hidden project prefix.
comwit storage create \ --project <project-id> \ --name acme-site-images \ --publicThe response includes the Storage id, exact bucket, S3 endpoint, lifecycle status, stable default domain, and public-delivery status.
storage_id stg_6f9a12c4d8304bc2a7e1696a52f0c731bucket acme-site-imagesendpoint https://storage.cloud.comwit.iostatus readydefault_domain stg-6f9a12c4d8304bc2a7e1696a52f0c731.comwit.linkpublic_access provisioning--public begins domain and TLS provisioning. Poll until it becomes active:
comwit storage get \ --project <project-id> \ --storage stg_6f9a12c4d8304bc2a7e1696a52f0c731You can create private Storage by omitting --public, then change it later:
comwit storage public enable --project <project-id> --storage <storage-id>comwit storage public disable --project <project-id> --storage <storage-id>2. Choose the token
Section titled “2. Choose the token”For local development, use a cwt_ token scoped to the project. For a deployed
app, create a project-owned cwp_ token in Project → Settings → Project
tokens. Give it only the scopes the app needs:
storage:readfor list/head/get;storage:writefor put/delete/multipart and lifecycle changes.
Copy the token when it is issued; the plaintext is not shown again.
3. Set app environment values
Section titled “3. Set app environment values”Storage is independent of an app. “Connect” means putting the existing Storage values into the app environment; it does not create or rename the bucket.
comwit apps env set --project <project-id> --app <app-id> \ COMWIT_STORAGE_ENDPOINT "https://storage.cloud.comwit.io"comwit apps env set --project <project-id> --app <app-id> \ COMWIT_STORAGE_BUCKET "acme-site-images"comwit apps env set --project <project-id> --app <app-id> \ COMWIT_STORAGE_TOKEN "cwp_..."comwit apps env set --project <project-id> --app <app-id> \ COMWIT_STORAGE_PUBLIC_BASE_URL \ "https://stg-6f9a12c4d8304bc2a7e1696a52f0c731.comwit.link"The console exposes the same values on the Storage detail page. Keep the token server-only and never print the complete environment in build logs.
4. Manage lifecycle
Section titled “4. Manage lifecycle”comwit storage list --project <project-id>comwit storage get --project <project-id> --storage <storage-id>comwit storage delete --project <project-id> --storage <storage-id>Delete returns 409 bucket_not_empty until every object and unfinished
multipart upload is removed. Comwit does not silently erase objects when you
delete an app or a Storage resource.
Continue with Use the S3 API.