Skip to main content

sceptre-s3-packager

PyPI version PyPI - Downloads

Hook and resolver for Sceptre v2 to package code dependencies and uploading it to an S3 bucket for usage in a template.

Inspired by https://github.com/cloudreach/sceptre-zip-code-s3

Getting started

Only Python 3 is actively being supported.

Install using pip:

pip install sceptre-s3-packager

Use the hook and resolver in your template config:

template_path: ...
hooks:
  before_create:
    - !sceptre_s3_upload ./directory-to-zip-to-s3
  before_update:
    - !sceptre_s3_upload ./directory-to-zip-to-s3
sceptre_user_data:
  Code:
    S3Bucket: my-s3-bucket
    S3Key: !sceptre_s3_key ./directory-to-zip-to-s3

Use the data in the template, e.g. by using Jinja2 template with something like:

  MyLambda:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        S3Bucket: {{ sceptre_user_data.Code.S3Bucket }}
        S3Key: {{ sceptre_user_data.Code.S3Key }}

Usage

Hook:

  • !sceptre_s3_upload <directory> (reads S3Bucket from sceptre_user_data.Code.S3Bucket)
  • !sceptre_s3_upload <directory>^^<s3-bucket>

Resolver:

  • !sceptre_s3_key <directory> (returns a path where the packaged directory is uploaded, e.g. sceptre/68063a99bb6d95401d688d28f19ee412)

Details

The hook will zip the contents of the directory and upload it as sceptre/MD5HASH to the S3-bucket, with MD5HASH being md5 hash of the zip file content.

When zipping all files will be given a fixed modification time, so that only the contents of the files are used to determine the upload file and cause invalidation on changes.

Release files for sceptre-s3-packager 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sceptre-s3-packager 0.4.0
File Size Uploaded
sceptre_s3_packager-0.4.0.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sceptre-s3-packager 0.4.0
File Interpreter ABI Platform
sceptre_s3_packager-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / sceptre_s3_packager-0.4.0.tar.gz

Download URL sceptre_s3_packager-0.4.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fb4ac6fa328d2a70cc2dcedd44d4ac0dad2101fa6aee85befee1d6a6168f12eb
BLAKE2b-256 checksum
How to use checksums
2b09283db3fc1735a779322e97005ebceb6df0f4648f3927cd368868c5277b68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.8.3 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5

Release files / sceptre_s3_packager-0.4.0-py3-none-any.whl

Download URL sceptre_s3_packager-0.4.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46b480d0a45866a47688dd2ab971cc8d795dd69912eee4cb592cceeeb1213d2c
BLAKE2b-256 checksum
How to use checksums
13a8caa4a04053918c689d2b95d31de613fab6db7762e205fa1489691be490cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.8.3 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page