Storage Component
Provisions an object storage bucket for files, assets, and binary data. Other components (websites, functions) can be granted access via links.
Configuration Fields
Field | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | required | — | Must be "storage" |
name | string | required | — | Unique component name. |
versioning | boolean | optional | false | Enable object versioning. Recommended for production data. |
lifecycleDays | integer | optional | — | Automatically delete objects after this many days. Must be ≥ 1. |
publicRead | boolean | optional | false | Allow unauthenticated public read access. Use only for truly public assets. |
encryption | string | optional | "managed" | Encryption at rest. "managed" uses provider-managed keys; "cmk" uses a customer-managed key (requires additional key configuration). |
uploads | array | optional | — | List of Maven artifact upload definitions. Each entry copies a build artifact into the bucket at deploy time. See Upload Object below. |
Upload Object
Each entry in the uploads array describes one Maven artifact to push into the bucket.
Field | Type | Required | Description |
|---|---|---|---|
artifact | string | required | Maven coordinate of the artifact to upload, in extended format groupId:artifactId:version[:classifier[:extension]]. See Artifact Coordinate Format below. |
destination | string | required | Target path within the bucket (e.g. releases/my-app/). Must end with / to denote a prefix. The artifact filename is appended automatically. |
unpack | boolean | optional | Default false. When false, the artifact file (e.g. my-app-1.0.0.jar) is uploaded as a single object at destination. When true, the artifact is treated as a ZIP/JAR archive and its contents are extracted and uploaded individually under destination — the archive file itself is not stored. |
classifier | string | optional | Maven classifier to select a specific artifact variant (e.g. sources, javadoc, dist). Overridden if a classifier is specified inline in the artifact coordinate. |
extension | string | optional | Artifact file extension override. Defaults to jar. Overridden if an extension is specified inline in the artifact coordinate. |
Artifact Coordinate Format
The artifact field accepts 3, 4, or 5 colon-separated parts:
Format | Example | Description |
|---|---|---|
groupId:artifactId:version | com.example:my-app:1.0.0 | Standard 3-part coordinate |
groupId:artifactId:version:classifier | com.example:my-app:1.0.0:sources | 4-part with inline classifier |
groupId:artifactId:version:classifier:extension | com.example:my-app:1.0.0:dist:zip | 5-part with inline classifier and extension |
When the classifier or extension is specified inline in the coordinate string, it takes precedence over the separate "classifier" and "extension" fields.
${version} Interpolation
The special token ${version} in the artifact coordinate is automatically replaced with the Maven project version (${project.version}) at deploy time. This allows subprojects to reference their own artifacts without hard-coding a version number:
{
"artifact": "uk.co.taylormadesoftware.cms:serverless-cms:${version}",
"destination": "releases/",
"unpack": true
}
If the POM version is 1.0.1-SNAPSHOT, the resolved coordinate becomes uk.co.taylormadesoftware.cms:serverless-cms:1.0.1-SNAPSHOT.
Note: The ${version} interpolation is performed specifically on artifact coordinate strings during the deploy phase. It is separate from config-level variables substitution and always resolves to the current Maven project version.
Uploads run during the serverless:deploy phase, after the bucket is created. If the bucket already exists, uploads are applied incrementally — existing objects at the same path are overwritten. Use versioning: true to retain previous versions.
Tip: The uploads format is also supported by the Website component. Add an uploads array to a website's providerSettings to deploy initial static content (HTML, CSS, JS) directly to the CloudFront origin bucket during deployment.
Cloud Resources Created
- S3 Bucket — named {derived-name}. Block public access enabled by default unless publicRead: true.
- S3 Bucket Policy — grants access to linked components (functions, websites).
- S3 Lifecycle Configuration — if lifecycleDays is set.
- Storage Account — general-purpose v2, Standard-LRS redundancy by default, provisioned via azure-resourcemanager-storage. Named {derived-name} (max 24 chars, lowercase alphanumeric only). Creation is idempotent — an already-existing account is treated as success.
- Blob Container — named data within the storage account, private access.
Limitations: Storage account names must be globally unique and ≤ 24 characters. The derived name is sanitised (non-alphanumeric stripped, lowercased) and truncated if necessary.
- Cloud Storage Bucket — provisioned via google-cloud-storage. Named {derived-name} (lowercased, 3–63 chars, {@code [a-z0-9._-]}); single-region by default. Creation is idempotent — an already-existing bucket is treated as success.
- IAM Bindings — grants access to linked service accounts.
JSON Example
{
"type": "storage",
"name": "asset-store",
"versioning": false,
"lifecycleDays": 90,
"publicRead": false,
"encryption": "managed",
"uploads": [
{
"artifact": "com.example:my-app:${version}",
"destination": "releases/my-app/",
"unpack": false
},
{
"artifact": "com.example:frontend-dist:1.0.0:dist:zip",
"destination": "static/",
"unpack": true
}
]
}
In the first upload, ${version} is replaced with the Maven project version at deploy time — so if the POM version is 2.1.0, the resolved artifact is com.example:my-app:2.1.0 and the file my-app-2.1.0.jar is uploaded to releases/my-app/my-app-2.1.0.jar.
In the second upload, the classifier (dist) and extension (zip) are specified inline in the coordinate string. The artifact frontend-dist-1.0.0-dist.zip is unpacked and its contents are uploaded individually under static/.
References
Storage is a target-only component — it does not initiate links to other components. Other components reference it to gain access.