S3 packager for Sceptre 2
Project description
sceptre-s3-packager
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>
(readsS3Bucket
fromsceptre_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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size sceptre_s3_packager-0.3.0-py3-none-any.whl (5.2 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size sceptre_s3_packager-0.3.0.tar.gz (3.7 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for sceptre_s3_packager-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8bffa5ffdd5c2f9cd36ee92632929b2677a4a80b41b52ced615b88272ff6a12 |
|
MD5 | 8b8fd7a71c7792b2be450a25ed237ed1 |
|
BLAKE2-256 | 5f7a03ad70d53d36e9cf5e059ea6caad5ab7e00981ba106498f1a462f18a3f9e |
Hashes for sceptre_s3_packager-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5347d4978690034c9c8e2e764ff634fb5c5209cce59531118435370b2e2e1c5 |
|
MD5 | 020ca2ccdbba7e7318e8ffcd3bda43c8 |
|
BLAKE2-256 | 3c348792e29a643624b25cd9d754805580b14c58a954bd5d6137f5ed15c7603c |