0.1.0 • Published 9 years ago

awsm-images v0.1.0

Weekly downloads
6
License
-
Repository
github
Last release
9 years ago

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)

  1. Create a new jaws project. Commit your files to version control so we can do diff later (trust me this is worth it)
  2. Run jaws module install https://github.com/awsm-org/img-resize
  3. 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 project resources-cf.json. Cool right?
  4. Run jaws env list <stage> all You will notice how IMAGE_RESIZE_BUCKET is not set.
  5. Run jaws env set <stage> all IMAGE_RESIZE_BUCKET <imgresize.yourdomain.from.new.jaws.project.prompt>
  6. Cd into back/aws_modules/imgresize/thumbnail and run jaws deploy lambda. Note how small the lambda code size is ;). Most of the size is the aws-sdk that can't currently be browserified.
  7. Find an image that is > 100x100 and test the lambda sending json {"url":"url here"}