This document describes how to deploy to a development environment and submit your contributions.
- Some basic knowledge of AWS and CloudFormation
- Requires SAM and aws-cli
- Building dependencies with the correct architecture requires Docker.
pushd dependencies/nodejs
docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm install
popdNote: You shouldn't need to repeat the above during code iteration, unless you make changes to dependencies/nodejs/package.json
The easiest way to deploy is using the SAM guided command:
sam deploy --guidedIf successful, make note of the Endpoint - IIIF Endpoint URL output. You'll need this to test the API.
Alternatively, you can use the aws-cli using the cloudformation command. You'll need to replace a few inputs below in order to give CloudFormation the information it needs to deploy the API:
stagingbucket- tells it where to put your packaged Lambda code so that CloudFormation can deploy it.stackname- tells it what CloudFormation Stack to deploy to.region- what AWS region to deploy to.imagesourcebucket- this will tell the deployed Lambda where to find your source images when serving requests.
aws cloudformation package \
--template-file ./template.yml \
--s3-bucket $stagingbucket \
--output-template-file package_output.yml
aws cloudformation deploy \
--capabilities CAPABILITY_IAM \
--region $region \
--stack-name $stackname \
--template-file package_output.yml \
--parameter-overrides SourceBucket=$imagesourcebucketRepeat these steps for any code changes to the lambda
To test the API, you'll need an identifier that exists in your source bucket. Make a request for that identifier with:
https://<myapiendpoint>/<myimageidentifier>/full/full/0/default.jpg
If you used SAM to deploy, replace <myapiendpoint> with the value from Endpoint - IIIF Endpoint URL.
If you did not use SAM, or otherwise need to find the API endpoint, a quick way to get it is by querying the Endpoint output from the stack. You can get this via the AWS CloudFormation console for your stack, or via the cli with:
aws cloudformation describe-stacks \
--region $region \
--stack-name=$stackname \
--query 'Stacks[0].Outputs[? OutputKey==`Endpoint`].OutputValue' \
--output textOnce you've completed your changes and confirmed that they are working:
- Push to a GitHub fork.
- Submit a Pull Request on GitHub. Your changes will be reviewed by one of the maintainers.