Skip to main content

Opinionated CDK Bucket Deployment object pruner for maintaining N old versions

Project description

CDK Bucket Deployment Expirator

build codecov dependencies Status npm

npm version PyPI version

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()),
    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.

This currently supports GitHub package.json dependency version (prod)

References

Project details


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.87.1.tar.gz.

File metadata

  • Download URL: cdk-bucket-deployment-expirator-1.87.1.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for cdk-bucket-deployment-expirator-1.87.1.tar.gz
Algorithm Hash digest
SHA256 21bd6cabc25ef596ffbf61f1677f75d3880b70b124aa2aca8f3d9ee2c6503b44
MD5 4de3f3d146c9ead8a368cfc9bbe4c3a4
BLAKE2b-256 5e7f265032195e89d275ebdab179ee4e1a27b1fdf4d2c3399be42a647d7b4b65

See more details on using hashes here.

File details

Details for the file cdk_bucket_deployment_expirator-1.87.1-py3-none-any.whl.

File metadata

  • Download URL: cdk_bucket_deployment_expirator-1.87.1-py3-none-any.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for cdk_bucket_deployment_expirator-1.87.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0ada58abd290cc8cfe775ee0001392ffa58e09b1373c6a44c29345788274615
MD5 6e0d10e23eed8ce5367c1240c9a0a420
BLAKE2b-256 c7710b2d6dee3e3ebbfea6b36adcee11790c9f19add7a5b70a8da1c5a5e53fb6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page