Skip to main content

getOrCreateBucket()

EXPERIMENTAL

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

Creates a Cloud Storage bucket for Remotion Cloud Run in your GCP project. If one already exists, it will get returned instead.

Only 1 bucket per region is necessary for Remotion Cloud Run to function.

ts
import { getOrCreateBucket } from "@remotion/cloudrun";
 
const { bucketName, alreadyExisted } = await getOrCreateBucket({
region: "us-east1",
});
 
console.log(bucketName); // "remotioncloudrun-32df3p"
ts
import { getOrCreateBucket } from "@remotion/cloudrun";
 
const { bucketName, alreadyExisted } = await getOrCreateBucket({
region: "us-east1",
});
 
console.log(bucketName); // "remotioncloudrun-32df3p"

Arguments

An object with the following properties:

region

The GCP region which you want to create a bucket in.

updateBucketState?

optional

Callback function that returns a state (string) of operation. Used by the CLI to provide a progress update. State will be one of the following;

  • Checking for existing bucket
  • Creating new bucket
  • Created bucket
  • Using existing bucket

Return value

A promise resolving to an object with the following properties:

bucketName

The name of your bucket that was found or created.

alreadyExisted

A boolean indicating whether the bucket already existed or was newly created.

See also