Bucket
This example shows a basic bucket configuration.
Storage bucket resource
- Durable and highly-available object storage with pay-per-use pricing.
Basic example
resources:myBucket:type: bucketproperties:# Allows you to upload a specified directory to the bucket on every deployment## - After the upload is finished, your bucket will contain the contents of the local folder.# - Files are uploaded using parallel, multipart uploads.## > Existing contents of the bucket will be deleted and replaced with the contents of the local directory.# You should not use `directoryUpload` for buckets with application-generated or user-generated content.## - Type: object# - Required: falsedirectoryUpload:# Path to the directory that should be uploaded to the bucket## - After the sync is finished, your bucket will contain the contents of the local folder.# - Path is relative to current working directory.## > Existing contents of the bucket will be deleted and replaced with the contents of the local directory.# You should not use bucket with autoSync enabled for application-generated or user-generated content.## - Type: string# - Required: truedirectoryPath: ./path/to/directoryPath# File options allow you to set properties of files (objects) during the upload.## - Type: array<object (reference)># - Required: falsefileOptions:- includePattern: example-valueexcludePattern: example-value# Configures which files should be excluded from upload (glob patterns).## - Relative to the `directoryPath`# - Following example patterns might include spaces due to docs rendering issues. Remove them before using these patterns in your config:# - Example pattern excluding all files ending in **.js.map**: `** /*.js.map`# - Example pattern excluding all files in directory named **test**: `test/**`## - Type: array<string># - Required: falseexcludeFilesPatterns:- example-value# Configures HTTP headers of uploaded files to be optimized for selected preset## Available presets:# - **static-website**:# - sets `cache-control` header value for all uploaded files to `public, max-age=0, s-maxage=31536000, must-revalidate`.# - this setup caches all the content on the CDN but never caches files in the browser.# - **gatsby-static-website**:# - optimized for static websites built using [Gatsby](https://www.gatsbyjs.com/)# according to [Gatsby caching recommendations](https://www.gatsbyjs.com/docs/caching/).# - **single-page-app**:# - optimized for a [Single page application](https://en.wikipedia.org/wiki/Single-page_application)# - `html` files are never cached (so that when you re-deploy your website, your users always get the latest content)# - All other assets (.js, .css, etc.) are cached indefinitely. You should **ALWAYS** add a content hash to the filename,# so that your users always get a new version of your website after you deploy it. To learn how to add a content hash# to your files, refer to the docs of your bundler, for example [webpack docs](https://webpack.js.org/guides/caching/).# - You can override these presets using custom `filters`.# > When `headersPreset` is used, `cdn.invalidateAfterDeploy` must also be configured.## - Type: enum: [gatsby-static-website, single-page-app, static-website]# - Required: false# - Allowed values: [gatsby-static-website, single-page-app, static-website]headersPreset: gatsby-static-website# Disables S3 transfer acceleration.## - S3 transfer acceleration improves upload times of your directory contents.# - Objects are uploaded to the nearest AWS edge location, and routed to the bucket from there using AWS backbone network.# - Used to improve upload times and security.# - S3 transfer acceleration includes (insignificant) additional costs.## - Type: boolean# - Required: false# - Default: falsedisableS3TransferAcceleration: false# Configures accessibility of the bucket.## - Type: object# - Required: falseaccessibility:# Configures pre-defined accessibility modes for the bucket## - Allows you to easily configure the most commonly used access patterns.# - Available modes:# - `public-read-write` - Everyone can read from and write to the bucket.# - `public-read` - Everyone can read from the bucket. Only compute resources and entities with sufficient IAM permissions can write to the bucket.# - `private` - (default) Only compute resources and entities with sufficient IAM permissions can read from or write to the bucket.# - For functions, batch jobs and container workloads, you can grant required IAM permissions to read/write from# the bucket using `allowsAccessTo` or `iamRoleStatements` in their configuration.## - Type: enum: [private, public-read, public-read-write]# - Required: true# - Default: private# - Allowed values: [private, public-read, public-read-write]accessibilityMode: vpc# Advanced access configuration that leverages IAM policy statements## - Gives fined-grained access control to the bucket## - Type: array<object (reference)># - Required: falseaccessPolicyStatements:- Resource: ["example-value"]Sid: example-value# Configures CORS (Cross-Origin Resource Sharing) HTTP headers for the bucket.## - Web browsers use CORS (Cross-Origin Resource Sharing) to block the website from making requests to a different origin# (server) than the one the website is served from. This means that if you make a request from a website served from# `https://my-website.s3.eu-west-1.amazonaws.com/` to `https://my-api.my-domain.com`, the request will fail.## - Type: object# - Required: falsecors:# Enables CORS (Cross-Origin Resource Sharing) HTTP headers for the bucket## - If you enable CORS and do not specify any cors rules, default rule with following configuration is used:# - AllowedMethods: `GET`, `PUT`, `HEAD`, `POST`, `DELETE`# - AllowedOrigins: '*'# - AllowedHeaders: `Authorization`, `Content-Length`, `Content-Type`, `Content-MD5`, `Date`,# `Expect`, `Host`, `x-amz-content-sha256`, `x-amz-date`, `x-amz-security-token`## - Type: boolean# - Required: trueenabled: true# List of CORS rules## - Web browsers use CORS (Cross-Origin Resource Sharing) to block the website from making requests to a different origin# (server) than the one the website is served from. This means that if you make a request from a website served from# `https://my-website.s3.eu-west-1.amazonaws.com/` to `https://my-api.my-domain.com`, the request will fail.# - If you enable CORS and do not specify any cors rules, the default rule with following configuration is used:# - AllowedMethods: `GET`, `PUT`, `HEAD`, `POST`, `DELETE`# - AllowedOrigins: '*'# - AllowedHeaders: `Authorization`, `Content-Length`, `Content-Type`, `Content-MD5`, `Date`,# `Expect`, `Host`, `x-amz-content-sha256`, `x-amz-date`, `x-amz-security-token`## - When the bucket receives a preflight request from a browser, it evaluates the CORS configuration for the bucket and uses the first CORS rule# that matches the incoming browser request to enable a cross-origin request. For a rule to match, the following conditions must be met:# - The request's Origin header must match one of allowedOrigins element.# - The request method (for example, `GET` or `PUT`) or the `Access-Control-Request-Method` header in case of a preflight `OPTIONS` request must be one of the allowedMethods.# - Every header listed in the request's `Access-Control-Request-Headers` header on the preflight request must match one of headers allowedHeaders.## - Type: array<object (reference)># - Required: falsecorsRules:- allowedOrigins: ["https://example.com","https://app.example.com"]# Enables versioning of objects in the bucket## - If enabled, bucket keeps multiple variants of an object.# - This can help you to recover objects from an accidental deletion/overwrite, or to store multiple objects with the same name.## - Type: boolean# - Required: falseversioning: true# Enables encryption of the objects stored in this bucket## - Objects are encrypted using the AES256 algorithm.## - Type: boolean# - Required: falseencryption: true# Configures the way objects are stored throughout their lifecycle.## - Lifecycle rules are used to transition objects to different storage class, delete old objects, etc.## - Type: array<union (anyOf)># - Required: falselifecycleRules:# Array of objects# Enables sending bucket events into default EventBridge bus.## - When enabled whenever certain actions happen in your bucket (object is created/deleted etc...), an event(notification) is sent into default event bus.# - To see the full list of all bucket events that are sent into the event bus refer to [AWS docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventBridge.html)## - Type: boolean# - Required: false# - Default: falseenableEventBusNotifications: false# Configures AWS Cloudfront CDN (Content Delivery Network) to be in front of your Bucket## - CDN is a globally distributed network that can cache responses from your bucket at the edge - close to your users.# - AWS Cloudfront has 205 edge locations on 6 continents.# - The CDN is used to:# - reduce latency & improve load times# - reduce bandwidth costs# - reduce the amount of traffic coming to the origin# - improve security# - The "origin" is the resource(bucket) attached to the CDN.# CDN caches responses from the origin at the edge for specified amount of time.# - If the content requested by the client is in the CDN cache,# the CDN immediately returns it to the client without making a request to the origin.# - If the content is NOT in the cache, the CDN makes a request to the Origin.# The response from the origin is then forwarded to the client, and cached at the edge.## - Type: object# - Required: falsecdn:# Enables the CDN### - Type: boolean# - Required: true# - Default: falseenabled: true# Rewrites incoming request to work for a single page application website## The routing works in the following way:# - If the path does have an extension (e.g. `.css`, `.js` or `.png`),# the request is not rewritten and the appropriate file is returned.# - If the path doesn't have an extension, the request is routed to `index.html`.# Single page applications handle routing on the client.## - Type: boolean# - Required: falserewriteRoutesForSinglePageApp: true# Disables URL normalization (ability to use clean urls without the `.html` extension)## - URL normalization is enabled by default.# - URL normalization is useful when you want to serve HTML files from the bucket# - When the URL normalization is enabled, the CDN is able to fetch correct HTML files# from the bucket even when incomplete URL is used (without the `.html` extension)# - This enables you to use URLs such as `<<my-domain.com>>/about` instead of urls# `<<my-domain.com>>/about.html` or `<<my-domain.com>>/about/index.html`## - Type: boolean# - Required: false# - Default: falsedisableUrlNormalization: false# Configures custom caching options## - Configures the caching behavior of your edge distribution (what & when should stay in cache, and when to refetch it from the origin).# - When response from the origin does not contain neither `cache-control` nor `expires` headers default caching behaviour is used.# - Default caching behaviour depends on the type of origin the CDN is attached to:# - **bucket** - by default objects are cached for 6 months (or until the CDN cache is invalidated).# - **http-api-gateway** and **application-load-balancer** - by default responses are not cached.## - Type: object# - Required: falsecachingOptions:# Only responses to the requests with these methods will be cached## - Possible values are:# - `['GET', 'HEAD']`# - `['GET', 'HEAD', 'OPTIONS']`## - Type: array<string># - Required: falsecacheMethods:- GET# The minimum amount of time in seconds that the objects will stay in the CDN cache before another request is sent to the origin## - To learn more about cache expiration, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html)## - Type: number# - Required: falseminTTL: 100# The maximum amount of time in seconds that the objects will stay in the CDN cache before another request is sent to the origin## - To learn more about cache expiration, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html)## - Type: number# - Required: falsemaxTTL: 100# The default amount of time in seconds that the objects will stay in the CDN cache before another request is sent to the origin## - To learn more about cache expiration, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html)## - Type: number# - Required: falsedefaultTTL: 100# Disables compression of the objects served by the CDN## - Compression is enabled by default.# - Compression can significantly reduce the size of the responses from the CDN.# In some cases, less than a quarter the size of the original. This can result in a better performance# and lower transfer costs.# - The CDN compresses objects using the `Gzip` and `Brotli` compression methods.# - If the viewer supports both formats, Brotli version is used.# - The client must indicate that it accepts compressed files using the `Accept-Encoding` HTTP header.# - To learn more about compression, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html)## - Type: boolean# - Required: false# - Default: falsedisableCompression: false# Configures HTTP headers, cookies, and URL query strings to include in the cache key## - By default the cache key depends on the type of origin the CDN routes to:# - **bucket** - only `url path` is part of the cache key# - **http-api-gateway** and **application-load-balancer** - only `url path` and `query string` are part of the cache key# - The values included in the cache key are automatically forwarded in the requests that the CDN sends to the origin.## - Type: object# - Required: falsecacheKeyParameters:# Configures cookies that will be included in the cache key## - By default no cookies are included in the cache key.## - Type: object# - Required: falsecookies:# No cookies are included in the cache key## - Type: boolean# - Required: falsenone: true# Only the listed cookies are included in the cache key## - Type: array<string># - Required: falsewhitelist:- example-value# All cookies except the ones listed are included in the cache key## - Type: array<string># - Required: falseallExcept:- example-value# All cookies are included in the cache key## - Type: boolean# - Required: falseall: true# Configures headers that will be included included in the cache key## - By default no headers (except `Accept-Encoding` for compression to work) are included in the cache key.## - Type: object# - Required: falseheaders:# No headers are included in the cache key## - Type: boolean# - Required: falsenone: true# Only the headers listed are included in the cache key## - Type: array<string># - Required: falsewhitelist:- example-value# Configures query parameters that will be included in the cache key## - The query params included in the cache key are automatically forwarded in the requests that the CDN sends to the origin.# - By default no query params are included in the cache key.## - Type: object# - Required: falsequeryString:# All query params are included in the cache key## - Type: boolean# - Required: falseall: true# No query params are included in the cache key## - Type: boolean# - Required: falsenone: true# Only the query parameters listed are included in the cache key## - Type: array<string># - Required: falsewhitelist:- example-value# Specifies id of pre-created cache policy that you wish to use## - Use this in a case you wish to use pre-created cache policy, instead of configuring `ttl`, `cacheKeyParameters` and other options.## - Type: string# - Required: falsecachePolicyId: example-value# Configures which parts of the request are forwarded to the origin (headers, query parameters, cookies etc.)## - Type: object# - Required: falseforwardingOptions:# Adds static headers that the CDN will add to all requests sent to the origin## - Type: array<object (reference)># - Required: falsecustomRequestHeaders:- headerName: myHeaderNamevalue: example-value# Configured methods that will be forwarded by the CDN to the origin## - If not set, all methods are forwarded## - Type: array<string># - Required: falseallowedMethods:- GET- POST- PUT- DELETE# Configured cookies forwarded to the origin## - If not set, all cookies are forwarded# - All cookies that are part of the cache key (see `cachingOptions`) are automatically forwarded to the origin.## - Type: object# - Required: falsecookies:# No cookies are forwarded to the origin## - Type: boolean# - Required: falsenone: true# Only the cookies listed are forwarded to the origin## - Type: array<string># - Required: falsewhitelist:- example-value# All cookies are forwarded to the origin## - Type: boolean# - Required: falseall: true# Configured headers will be forwarded to the origin## - If not set, all headers are forwarded# - All headers that are part of the cache key (see `cachingOptions`) are automatically forwarded to the origin.## > Warning: `Authorization` header must be set to be used as a cache key parameter within the caching options in order to be forwarded to the origin. This is to avoid unauthorized access to the resources.## - Type: object# - Required: falseheaders:# No headers are forwarded to the origin## - Type: boolean# - Required: falsenone: true# Only the headers listed are forwarded to the origin## - Type: array<string># - Required: falsewhitelist:- example-value# All viewer headers are forwarded to the origin## - Type: boolean# - Required: falseallViewer: true# All viewer headers and additional listed CDN headers are forwarded to the origin## - Type: array<string># - Required: falseallViewerAndWhitelistCloudFront:- example-value# All viewer headers except those that are explicitly specified are forwarded to the origin## - Type: array<string># - Required: falseallExcept:- example-value# Configured query params will be forwarded to the origin## - If not set, all query string parameters are forwarded# - All query string parameters that are part of the cache key (see `cachingOptions`) are automatically forwarded to the origin.## - Type: object# - Required: falsequeryString:# All query params are forwarded to the origin## - Type: boolean# - Required: falseall: true# No query params are forwarded to the origin## - Type: boolean# - Required: falsenone: true# Only the query parameters listed are forwarded to the origin## - Type: array<string># - Required: falsewhitelist:- example-value# Specifies id of pre-created origin request policy that you wish to use## - Use this in a case you wish to use pre-created origin request policy, instead of configuring `cookies`, `headers` and `queryString` options.## - Type: string# - Required: falseoriginRequestPolicyId: example-value# Enables you to redirect specific requests to a different origin## - Each incoming request to the CDN is first evaluated against route rewrites. The requested path is compared with path pattern specified in route rewrite.# - If the requested path matches the path pattern specified by route rewrite, the request is sent to the configured route.# - Route rewrites are evaluated in order. The first match is where the request will be sent to.# - If no match is found, request is sent to the default origin (the one that the CDN is attached to).## **Example use cases**:# - Most of the content you are serving is a static content# served from a bucket (static website). Some content however needs to be# rendered dynamically by a lambda function. You can route paths that need# to be rendered dynamically to the Lambda function.# - You want to cache your `jpg` files longer than# other files. You can create route rewrite that will catch every path# ending with `jpg` and set custom caching options for these paths.## - Type: array<object (reference)># - Required: falserouteRewrites:- path: example-valueroutePrefix: example-value# Attaches a custom domains to this CDN## Stacktape allows you to connect your custom domain names to some of your resources# (Web Service, Nextjs web, HTTP API Gateways, Application Load Balancers and Buckets with CDNs).## Connecting a custom domain to the resource does 2 things:# - **Creates DNS records**:# - If you use your custom domain with a resource, Stacktape automatically creates a DNS record (during deploy) pointing the specified domain name to the resource.# - **Adds TLS certificates**# - If the origin resource (HTTP API Gateway, Application Load Balancer or CDN) uses HTTPS protocol, Stacktape takes care of# issuing and attaching correct (free, AWS-managed) certificate to the resource.# This means, you do not have to deal with TLS termination as it is handled by the connected resource.# - If you want to use your own certificates, you can configure `customCertificateArns`.## > To manage a custom domain, it first needs to be added to your AWS account.# > This means that a [hosted zone](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/AboutHZWorkingWith.html)# > (collection of records managed together for a given domain)# > for your domain exists in your AWS account and your domain registrar's name servers are pointing to it.# > To learn more, refer to [Adding a domain guide](https://docs.stacktape.com/other-resources/domains-and-certificates/#adding-domain).## - Type: array<object (reference)># - Required: falsecustomDomains:- domainName: api.example.comcustomCertificateArn: example-value# Configures Edge function triggers## - You can associate `edge-lambda-function` with CDN to be executed:# - `onRequest` - function is executed when CDN receives a request from a client(viewer) before checking CDN cache# - `onResponse` - function is executed before returning the response to the client(viewer)## - Potential use-cases for using edge functions:# - generating immediate HTTP response without the need to check CDN cache or forward to the origin# - modifying request (i.e rewrite url, headers etc) before forwarding to the origin# - inspection of cookies# - inspection/validation of authorization headers and tokens## - Type: object# - Required: falseedgeFunctions:# Name of the edge-lambda-function in the config## - `onRequest` function is triggered when CDN receives a request from a client(viewer):# - You can modify the request before forwarding it to the origin# - You can return immediate response to the client(viewer)# - You can make network calls to external resources to confirm user credentials, or fetch additional content# - The body of the request is exposed to the function with some restrictions# (refer to [AWS docs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/edge-functions-restrictions.html#lambda-at-edge-restrictions-request-body) for more details)## - Type: string# - Required: falseonRequest: example-value# Name of the edge-lambda-function in the config## - `onResponse` function is triggered before CDN returns response to the client(viewer):# - You can modify the response (headers, cookies) before returning to the client# - The function does not execute in following cases:# - When the origin returns an HTTP status code of 400 or higher.# - When the response is generated from a function that was triggered by a viewer request event (`onRequest` function).## - Type: string# - Required: falseonResponse: example-value# Name of the edge-lambda-function in the config## > Use `onOriginRequest` trigger only if you are an advanced user and know what you are doing.# > Using this trigger can **override the default behaviour configured by Stacktape**.# > Stacktape uses pre-configured lambdas together with this trigger when using CDN with:# > - **bucket** - Stacktape uses this trigger with pre-configured lambda to correctly resolve URLs# > - **web-service, http-api-gateway, application-load-balancer** - Stacktape uses this trigger with pre-configured lambda to adjust headers before sending to origin# - `onOriginRequest` function is triggered after CDN receives a request from a client(viewer) but before the request is send to the origin:# - This means that function is NOT triggered when response is found in the cache (as no request to origin needs to happen)# - You can modify the request before forwarding it to the origin# - You can return immediate response to the client(viewer) - the response will be cached same way as if it was from the origin# - You can make network calls to external resources to confirm user credentials, or fetch additional content# - The body of the request is exposed to the function with some restrictions# (refer to [AWS docs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/edge-functions-restrictions.html#lambda-at-edge-restrictions-request-body) for more details)## - Type: string# - Required: falseonOriginRequest: example-value# Name of the edge-lambda-function in the config## - `onOriginResponse` function is triggered after origin returns response but before it is sent back to the client(viewer):# - You can modify the response (headers, cookies) before returning to the client - the response will be cached same way as if it was from the origin# - You can update the response status.## - Type: string# - Required: falseonOriginResponse: example-value# Configures locations from which the CDN serves traffic## - Higher price class results in more locations that serve your traffic.# - This can result in better performance in some regions, but is more costly.# - Example: If your users are located only in US & Europe, you can save money by configuring `PriceClass_100`# - To learn more about price classes, refer to [AWS docs](https://aws.amazon.com/cloudfront/pricing/)## - Type: enum: [PriceClass_100, PriceClass_200, PriceClass_All]# - Required: false# - Default: PriceClass_All# - Allowed values: [PriceClass_100, PriceClass_200, PriceClass_All]cloudfrontPriceClass: PriceClass_All# Prefixes requests to the origin with specified prefix## - Incoming requests will be prefixed with `defaultRoutePrefix` before being forwarded to the origin.# - Example: If the CDN receives a request with path `/my/resource/url`, the request will be sent to the origin as# `/default_route_prefix/my/resource/url`## - Type: string# - Required: falsedefaultRoutePrefix: example-value# Custom error document URL## - Error document is requested by the CDN if the original request to the origin responds with an error code `404`.# - Example: `/error.html`## - Type: string# - Required: false# - Default: /404.htmlerrorDocument: /404.html# Custom index (root) document served for requests with root path `/`### - Type: string# - Required: false# - Default: '/index.html'indexDocument: '/index.html'# Disables invalidating of the CDN cache after each deployment## - Cache is by default invalidated after every deploy to prevent serving outdated content to your users.# - When invalidating the cache, CDN flushes all the cached content and new requests# will result in a request to the origin (bucket, application-load-balancer, function or http-api-gateway)## - Type: boolean# - Required: false# - Default: falsedisableInvalidationAfterDeploy: false# Name of the 'web-app-firewall' resource to used with your CDN## - You can use `web-app-firewall` to protect your resources from common web exploits that could affect application availability, compromise security, or consume excessive resources.# - Web app firewall protects your application by filtering dangerous requests coming to your app.# You can read more about the firewall [in our docs](https://docs.stacktape.com/security-resources/web-app-firewalls/).## - Type: string# - Required: falseuseFirewall: example-value
LifecycleRules alternatives
expiration
This example shows how to configure lifecyclerules using expiration.
resources:myBucket:type: bucketproperties:# Configures the way objects are stored throughout their lifecycle.## - Lifecycle rules are used to transition objects to different storage class, delete old objects, etc.## - Type: object# - Required: truelifecycleRules:## - Type: string# - Required: truetype: expiration## - Type: object# - Required: trueproperties:# Number of days after the object is considered expired## - Relative to the date uploaded## - Type: number# - Required: truedaysAfterUpload: 100# Prefix of the objects to which the lifecycle rule is applied## - Type: string# - Required: falseprefix: example-value# Tags of the objects to which the lifecycle rule is applied## - To learn more about tagging objects, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)## - Type: array<object (reference)># - Required: falsetags:- key: example-valuevalue: example-value
non-current-version-expiration
This example shows how to configure lifecyclerules using non-current-version-expiration.
resources:myBucket:type: bucketproperties:# Configures the way objects are stored throughout their lifecycle.## - Lifecycle rules are used to transition objects to different storage class, delete old objects, etc.## - Type: object# - Required: truelifecycleRules:## - Type: string# - Required: truetype: non-current-version-expiration## - Type: object# - Required: trueproperties:# Number of days after the `non-current` object becomes expired.## - Relative to date it became `non-current` (old)# - This rule is effective only if the bucket has versioning enabled.## - Type: number# - Required: truedaysAfterVersioned: 100# Prefix of the objects to which the lifecycle rule is applied## - Type: string# - Required: falseprefix: example-value# Tags of the objects to which the lifecycle rule is applied## - To learn more about tagging objects, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)## - Type: array<object (reference)># - Required: falsetags:- key: example-valuevalue: example-value
class-transition
This example shows how to configure lifecyclerules using class-transition.
resources:myBucket:type: bucketproperties:# Configures the way objects are stored throughout their lifecycle.## - Lifecycle rules are used to transition objects to different storage class, delete old objects, etc.## - Type: object# - Required: truelifecycleRules:## - Type: string# - Required: truetype: class-transition## - Type: object# - Required: trueproperties:# Number of days after the object is transitioned to another storage class## - Relative to the date uploaded# - Depending on how often you need to access your objects, transitioning them to another storage can lead to a significant price reduction.## - Type: number# - Required: truedaysAfterUpload: 100# Storage class to transition to## - By default, all objects are in the standard (general purpose) class.# - Depending on your access patterns, you can transition your objects to a different storage class to save costs.# - To better understand differences between storage classes, refer to# [AWS Docs](https://aws.amazon.com/s3/storage-classes/)# - To learn more about storage class transitions, refer to# [AWS Docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html)## - Type: enum: [DEEP_ARCHIVE, GLACIER, INTELLIGENT_TIERING, ONEZONE_IA, STANDARD_IA]# - Required: true# - Allowed values: [DEEP_ARCHIVE, GLACIER, INTELLIGENT_TIERING, ONEZONE_IA, STANDARD_IA]storageClass: DEEP_ARCHIVE# Prefix of the objects to which the lifecycle rule is applied## - Type: string# - Required: falseprefix: example-value# Tags of the objects to which the lifecycle rule is applied## - To learn more about tagging objects, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)## - Type: array<object (reference)># - Required: falsetags:- key: example-valuevalue: example-value
non-current-version-class-transition
This example shows how to configure lifecyclerules using non-current-version-class-transition.
resources:myBucket:type: bucketproperties:# Configures the way objects are stored throughout their lifecycle.## - Lifecycle rules are used to transition objects to different storage class, delete old objects, etc.## - Type: object# - Required: truelifecycleRules:## - Type: string# - Required: truetype: non-current-version-class-transition## - Type: object# - Required: trueproperties:# Number of days after the `non-current` object is transitioned to another storage class## - Relative to date it became `non-current` (old)# - Depending on how often you need to access your objects, transitioning them to another storage can lead to a significant price reduction.## - Type: number# - Required: truedaysAfterVersioned: 100# Storage class to transition to## - To learn more about storage classes and transitions, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html)## - Type: enum: [DEEP_ARCHIVE, GLACIER, INTELLIGENT_TIERING, ONEZONE_IA, STANDARD_IA]# - Required: true# - Allowed values: [DEEP_ARCHIVE, GLACIER, INTELLIGENT_TIERING, ONEZONE_IA, STANDARD_IA]storageClass: DEEP_ARCHIVE# Prefix of the objects to which the lifecycle rule is applied## - Type: string# - Required: falseprefix: example-value# Tags of the objects to which the lifecycle rule is applied## - To learn more about tagging objects, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)## - Type: array<object (reference)># - Required: falsetags:- key: example-valuevalue: example-value
abort-incomplete-multipart-upload
This example shows how to configure lifecyclerules using abort-incomplete-multipart-upload.
resources:myBucket:type: bucketproperties:# Configures the way objects are stored throughout their lifecycle.## - Lifecycle rules are used to transition objects to different storage class, delete old objects, etc.## - Type: object# - Required: truelifecycleRules:## - Type: string# - Required: truetype: abort-incomplete-multipart-upload## - Type: object# - Required: trueproperties:# Number of days after the in-complete upload is aborted, and it's parts deleted## - Relative to the start of multipart upload## - Type: number# - Required: truedaysAfterInitiation: 100# Prefix of the objects to which the lifecycle rule is applied## - Type: string# - Required: falseprefix: example-value# Tags of the objects to which the lifecycle rule is applied## - To learn more about tagging objects, refer to [AWS Docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)## - Type: array<object (reference)># - Required: falsetags:- key: example-valuevalue: example-value
RouteTo alternatives
application-load-balancer
This example shows how to configure routeto using application-load-balancer.
resources:myBucket:type: bucketproperties:cdn:routeRewrites:items:## - Type: object# - Required: truerouteTo:## - Type: string# - Required: truetype: application-load-balancer## - Type: object# - Required: trueproperties:# Name of the Load balancer## - Type: string# - Required: trueloadBalancerName: myLoadBalancerName# Port of the Load balancer listener## - You need to specify listener port if the load balancer you are routing to uses custom listeners.## - Type: number# - Required: falselistenerPort: 3000# Explicitly sets the origin domain name you wish to use when forwarding to load balancer## - This is required only if the load balancer has no `customDomains` attached and listener uses `customCertificateArns`## - Type: string# - Required: falseoriginDomainName: myOriginDomainName
http-api-gateway
This example shows how to configure routeto using http-api-gateway.
resources:myBucket:type: bucketproperties:cdn:routeRewrites:items:## - Type: object# - Required: truerouteTo:## - Type: string# - Required: truetype: http-api-gateway## - Type: object# - Required: trueproperties:# Name of the HTTP Api Gateway## - Type: string# - Required: truehttpApiGatewayName: myHttpApiGatewayName
function
This example shows how to configure routeto using function.
resources:myBucket:type: bucketproperties:cdn:routeRewrites:items:## - Type: object# - Required: truerouteTo:## - Type: string# - Required: truetype: function## - Type: object# - Required: trueproperties:# Name of the Web Service resource## - Type: string# - Required: truefunctionName: myFunctionName
custom-origin
This example shows how to configure routeto using custom-origin.
resources:myBucket:type: bucketproperties:cdn:routeRewrites:items:## - Type: object# - Required: truerouteTo:## - Type: string# - Required: truetype: custom-origin## - Type: object# - Required: trueproperties:# Domain name of the custom origin.## Example: `mydomain.com` or `domain.example.com`## - Type: string# - Required: truedomainName: api.example.com# Protocol to use when connecting to custom origin.### - Type: enum: [HTTP, HTTPS]# - Required: false# - Default: HTTPS# - Allowed values: [HTTP, HTTPS]protocol: HTTP# Port of the custom origin.## By default port number 443 is used for `HTTPS` origins and port number 80 is used for `HTTP` origins.## - Type: number# - Required: false# - Default: 443port: 3000
bucket
This example shows how to configure routeto using bucket.
resources:myBucket:type: bucketproperties:cdn:routeRewrites:items:## - Type: object# - Required: truerouteTo:## - Type: string# - Required: truetype: bucket## - Type: object# - Required: trueproperties:# Name of the bucket## - Type: string# - Required: truebucketName: my-example-bucket# Disables URL normalization (ability to use clean urls without the `.html` extension)## - URL normalization is enabled by default.# - URL normalization is useful when you want to serve HTML files from the bucket# - When the URL normalization is enabled, the CDN is able to fetch correct HTML files# from the bucket even when incomplete URL is used (without the `.html` extension)# - This enables you to use URLs such as `<<my-domain.com>>/about` instead of urls# `<<my-domain.com>>/about.html` or `<<my-domain.com>>/about/index.html`## - Type: boolean# - Required: false# - Default: falsedisableUrlNormalization: false