Skip to main content

S3 Upload

Stable

Type: DEVRAMPS:S3:UPLOAD

Category: deploy

Version: 1.0.0


Description

Upload a bundle artifact to an S3 bucket, with optional decompression.

Downloads a bundle artifact from DevRamps artifact storage and uploads it to a user-specified S3 bucket. Supports decompressing the bundle ZIP before uploading so files land in their original directory structure — ideal for deploying frontend assets to S3 for CloudFront serving.

When decompress is enabled, individual files are uploaded preserving their relative directory structure under the specified prefix. Content-Type is auto-detected from file extensions for common web file types (HTML, CSS, JS, JSON, images, fonts, etc.). Custom S3 metadata such as Cache-Control can be applied to all uploaded files.

When clean is enabled, all existing objects under the target prefix are deleted before uploading. This ensures stale files from previous deployments are removed.

Commonly chained with DEVRAMPS:CLOUDFRONT:INVALIDATE to bust CDN cache after deploying new assets.

Parameters

Required Parameters

ParameterTypeDescription
source_s3_urlstringS3 URL of the bundle artifact (e.g., s3://bucket/key.zip). Use ${{ stage.artifacts['name'].s3_url }} to reference a bundle artifact.
bucketstringTarget S3 bucket name.
decompressbooleanWhen true, extract the ZIP and upload individual files preserving directory structure. When false, upload the ZIP as a single object.
cleanbooleanWhen true, delete all existing objects under the target prefix before uploading.

Optional Parameters

ParameterTypeDefaultDescription
prefixstring-Key prefix path within the bucket (e.g., 'assets/').
metadataobject-S3 object metadata to apply to uploaded files.
account_idstring-AWS account ID. Defaults to stage account.
regionstring-AWS region. Defaults to stage region.

Example Usage

- type: DEVRAMPS:S3:UPLOAD
name: Deploy Frontend to S3
params:
source_s3_url: ${{ stage.artifacts['frontend-bundle'].s3_url }}
bucket: my-frontend-bucket
prefix: assets/
decompress: true
clean: true
metadata:
cache_control: "max-age=31536000"