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
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.
Source Distribution
Built Distribution
Hashes for sceptre_s3_packager-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b83653d0d55553995f6151a2662644dc32e8706ef7d85b27025218df42a49959 |
|
MD5 | 878e2947d0e82b469eecc2e7c6da4367 |
|
BLAKE2b-256 | 24f21042ef599d6e52d58dfe46888612a035b10821f57315303b915f22369bb4 |
Hashes for sceptre_s3_packager-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1524a88850867859db2a6e97c9954bffc1ef459690f1f5b9d9f8359bc713d440 |
|
MD5 | 24d5e3efdefefd5499bd8fc521d34753 |
|
BLAKE2b-256 | bee62e1249272183e752f7f9d63d14c5a0078c3b91f2142279d741538c457091 |