bucket:sync

Overview and basic usage

bucket:sync

Synchronizes the contents of a local directory with an S3 bucket.

You can specify the bucket in two ways:

  • Using Stacktape configuration: Provide the stage and resourceName. Stacktape will identify the bucket from the deployed stack and sync the directory specified in the configuration file.
  • Using bucket ID: Provide a valid bucketId (AWS physical resource ID or bucket name) and a sourcePath.

Files in the bucket that are not present in the source directory will be removed.


stacktape bucket:sync --region <<region>>

API reference

Options
region (--r)Required

AWS Region

Type: string

Possible values: af-south-1ap-east-1ap-northeast-1ap-northeast-2ap-northeast-3ap-south-1ap-southeast-1ap-southeast-2ca-central-1eu-central-1eu-north-1eu-south-1eu-west-1eu-west-2eu-west-3me-south-1sa-east-1us-east-1us-east-2us-west-1us-west-2

The AWS region for the operation. For a list of available regions, see the AWS documentation.

stage (--s)Required

Stage

Type: string

The stage for the operation (e.g., production, staging, dev-john). You can set a default stage using the defaults:configure command. The maximum length is 12 characters.

awsAccount (--aa)

AWS Account

Type: string

The name of the AWS account to use for the operation. The account must first be connected in the Stacktape console.

bucketId (--bi)

Bucket ID

Type: string

The identifier of the destination bucket (either the AWS physical resource ID or the bucket name).

configPath (--cp)

Config File Path

Type: string

The path to your Stacktape configuration file, relative to the current working directory.

currentWorkingDirectory (--cwd)

Current Working Directory

Type: string

The working directory for the operation. All file paths in your configuration will be resolved relative to this directory. By default, this is the directory containing the configuration file.

headersPreset (--hp)

Headers Preset

Type: string

Possible values: gatsby-static-websitesingle-page-appstatic-website

Configures HTTP headers of uploaded files based on a selected preset.

  • static-website: Caches all content on the CDN but never in the browser. Sets cache-control to public, max-age=0, s-maxage=31536000, must-revalidate.
  • gatsby-static-website: Optimized for static websites built with Gatsby, following Gatsby caching recommendations.
  • single-page-app: Optimized for Single-Page Applications. index.html is never cached, while all other assets (JS, CSS, etc.) are cached indefinitely. You should always add a content hash to asset filenames to ensure users get the latest version after a deployment.
help (--h)

Show Help

Type: string

If provided, the command will not execute and will instead print help information.

invalidateCdnCache (--icc)

Invalidate CDN Cache

Type: boolean

If true, invalidates the cache of the CDN connected to the bucket.

logFormat (--lf)

Log Format

Type: string

Possible values: basicfancyjsonnormal

The format of logs printed to the console.

  • fancy: Colorized and dynamically re-rendered logs.
  • normal: Colorized but not dynamically re-rendered logs.
  • basic: Simple text only.
  • json: Logs printed as JSON objects.
logLevel (--ll)

Log Level

Type: string

Possible values: debugerrorinfo

The level of logs to print to the console.

  • info: Basic information about the operation.
  • error: Only errors.
  • debug: Detailed information for debugging.
profile (--p)

AWS Profile

Type: string

The AWS profile to use for the command. You can manage profiles using the aws-profile:* commands and set a default profile with defaults:configure.

projectName (--prj)

Project Name

Type: string

The name of the Stacktape project for this operation.

resourceName (--rn)
No description

Type: string

sourcePath (--sp)

Source Path

Type: string

The path to the directory to synchronize with the bucket. This can be an absolute path or relative to the current working directory.

templateId (--ti)

Template ID

Type: string

The ID of the template to download. You can find a list of available templates on the Config Builder page.