Skip to content

Create & connect Storage

Choose a globally unique bucket name. Comwit uses it exactly and does not add a hidden project prefix.

Terminal window
comwit storage create \
--project <project-id> \
--name acme-site-images \
--public

The response includes the Storage id, exact bucket, S3 endpoint, lifecycle status, stable default domain, and public-delivery status.

storage_id stg_6f9a12c4d8304bc2a7e1696a52f0c731
bucket acme-site-images
endpoint https://storage.cloud.comwit.io
status ready
default_domain stg-6f9a12c4d8304bc2a7e1696a52f0c731.comwit.link
public_access provisioning

--public begins domain and TLS provisioning. Poll until it becomes active:

Terminal window
comwit storage get \
--project <project-id> \
--storage stg_6f9a12c4d8304bc2a7e1696a52f0c731

You can create private Storage by omitting --public, then change it later:

Terminal window
comwit storage public enable --project <project-id> --storage <storage-id>
comwit storage public disable --project <project-id> --storage <storage-id>

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:read for list/head/get;
  • storage:write for put/delete/multipart and lifecycle changes.

Copy the token when it is issued; the plaintext is not shown again.

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.

Terminal window
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.

Terminal window
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.