Opinionated CDK Bucket Deployment object pruner for maintaining N old versions
Project description
CDK Bucket Deployment Expirator
Why This Package
I've been having issues with my React deployments to AWS S3 while using Cloudfront due to browsers caching and attempting to load chunks that were unavailable after using CDK Bucket Deployment.
I had been using prune: true
to clean up the bucket and this was causing all previous chunks to be deleted. However, the reality is we want to support N number of older chunks, just in case, and provide a mechanism for alerting the user that a new version is available (not part of this construct).
Must Be Used With CDK Bucket Deployment
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from aws_cdk.aws_s3 import Bucket
from aws_cdk.aws_s3_deployment import BucketDeployment, Source
bucket = Bucket(self, "SourceBucket")
now = Date().get_time()
bucket_deployment = BucketDeployment(self, "deploy-spa",
sources=[Source.asset("path/to/assets")],
destination_bucket=bucket,
metadata=UserDefinedObjectMetadata(deployed=now.to_string()), # This actually turns into x-amz-meta-x-amzn-meta-deployed right now
prune=False
)
BucketDeploymentExpirator(self, "expirator",
bucket_deployment=bucket_deployment, # need this to add cfn depends on
source_bucket=bucket
)
Versioning
I will attempt to align the major and minor version of this package with [AWS CDK], but always check the release descriptions for compatibility.
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cdk-bucket-deployment-expirator-1.74.1rc1.tar.gz
.
File metadata
- Download URL: cdk-bucket-deployment-expirator-1.74.1rc1.tar.gz
- Upload date:
- Size: 951.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7eb83846c5e738c1b7ce316f9438a320a2d28f22f28e10d8341b3aa88e9f304 |
|
MD5 | b0210e99a701d5f70cc6a6fff9c2ddfd |
|
BLAKE2b-256 | 6b13b33cfb8ddc79448e452e8668999ac5b05010e20e25261fd08deab2bc072f |
File details
Details for the file cdk_bucket_deployment_expirator-1.74.1rc1-py3-none-any.whl
.
File metadata
- Download URL: cdk_bucket_deployment_expirator-1.74.1rc1-py3-none-any.whl
- Upload date:
- Size: 950.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f9d1935674213c9d4d1ebb4b647eecdcda56bb2e4522e7a46314b3ba3b1d174 |
|
MD5 | e67f54444031ca6c3c2fef3c66e6518a |
|
BLAKE2b-256 | 27ca9b4712e34501c8a1ab521e76f3323d085a7fc6d44f8bd9d4af45367c51a3 |