awsm-images
v0.1.0
Published
This awsm does image modifications (resizing, etc.) and showcases many of the features and integration points of JAWS:
Downloads
9
Readme
awsm-images
This awsm does image modifications (resizing, etc.) and showcases many of the features and integration points of JAWS:
- browserify optimization
- including own version of the
aws-sdk
- ENV var integration into code and exposing via the
awsm.json:lambda.envVars
extension point - Leverage awsm CloudFormation extension points (creates s3 bucket AND sets up fine grain perms)
Quickstart
Goal: Given image url, creates a thumbnail and saves to s3 bucket with the JAWS_DATA_MODEL_STAGE
prefix (default jaws env var) and an env var defined by this awsm (IMAGE_RESIZE_BUCKET
)
- Create a new jaws project. Commit your files to version control so we can do diff later (trust me this is worth it)
- Run
jaws module install https://github.com/awsm-org/img-resize
- This downloads the module, installs its dependencies (via npm), merges in CF resources to project
resources-cf.json
, merges in CF lambda IAM rules to projectresources-cf.json
. Cool right? - Run
jaws env list <stage> all
You will notice howIMAGE_RESIZE_BUCKET
is not set. - Run
jaws env set <stage> all IMAGE_RESIZE_BUCKET <imgresize.yourdomain.from.new.jaws.project.prompt>
- Cd into
back/aws_modules/imgresize/thumbnail
and runjaws deploy lambda
. Note how small the lambda code size is ;). Most of the size is the aws-sdk that can't currently be browserified. - Find an image that is > 100x100 and test the lambda sending json
{"url":"url here"}