This module makes it easy to deploy and manage an AWS Lambda@Edge function.
Lambda@Edge gives you a way to run code on-demand in AWS Edge locations without having to manage servers.
Lambda@Edge has the following limitations compared to regular Lambda (see
the CloudFront Developer Guide
for the full details):
The functions must not have any environment variables.
The execution timeout must not be higher than 30 seconds.
The function must be versioned in order to be a target for Cloudfront events.
The function must be deployed in the us-east-1 region.
The function runtime must be one of:
nodejs10.x or newer
python3.7 or newer
How do you use this module?
See the root README for instructions on using Terraform modules.
See variables.tf for all the variables you can set on this module.
The general idea is to:
Create a folder that contains your source code in one of the supported languages: Python, JavaScript, Java, etc (see
Lambda programming model for the complete
list).
Use this lambda-edge module to automatically zip that folder, upload it to AWS, and configure it as a Lambda function.
Trigger your Lambda function using one of the following options:
AWS Lambda lets you run code without provisioning or managing servers. You define a
function in a supported language (currently: Python, JavaScript, Java, and C#), upload the code to Lambda, specify how
that function can be triggered, and then AWS Lambda takes care of all the details of deploying and scaling the
infrastructure to run that code.
How do you add additional IAM policies and permissions?
By default, the lambda-edge module configures your lambda function with an IAM role that allows it to write logs to
CloudWatch Logs. The ID of the IAM role is exported as the output iam_role_id and the ID of the lambda function is
exported as the output function_arn, so you can add custom rules using the aws_iam_role_policy or
aws_lambda_permission resources, respectively. For example, to allow your lambda function to be triggered by SNS:
Lambda@Edge stores CloudWatch Logs in the AWS Regions closest to the location where the function receives traffic and is
executed. That means a log group must be created in every region that have Regional Edge Caches.
Instructions on how to do this can be found at the lambda-edge-multi-region-log-groups module. To see which regions are receiving traffic, you can find graphs of metrics for the
function on the CloudFront console and choose your region there.
How to trigger this Lambda function from Cloudfront
This module deploys the Lambda function but doesn't create any CloudFront trigger. There are two ways to create those
triggers:
{"treedata":{"name":"root","toggled":true,"children":[{"name":".circleci","children":[{"name":"config.yml","path":".circleci/config.yml","sha":"9890e1fa5084db22ba70114b26021aae657db1fa"},{"name":"post-upgrade-test-results.sh","path":".circleci/post-upgrade-test-results.sh","sha":"a4867e8fbdc334b7a90259568ee41ea577fbe764"},{"name":"set-upgrade-test-vars.sh","path":".circleci/set-upgrade-test-vars.sh","sha":"04ccab865d51c1169f7ae4648c38a3d98a9889ab"}]},{"name":".github","children":[{"name":"ISSUE_TEMPLATE","children":[{"name":"bug_report.md","path":".github/ISSUE_TEMPLATE/bug_report.md","sha":"d2e87e27c601e423865ed660ec697082470ca60f"},{"name":"feature_request.md","path":".github/ISSUE_TEMPLATE/feature_request.md","sha":"023a33099be2336476930c96e17ff1ba5dc55348"}]},{"name":"pull_request_template.md","path":".github/pull_request_template.md","sha":"6b100e40e323b5b07f40ed30616277c51c9f4b9e"}]},{"name":".gitignore","path":".gitignore","sha":"8a502c2bba2544ba8beae9a45fde2398da238cd7"},{"name":".patcher","children":[{"name":"patches","children":[{"name":"v0.14.0","children":[{"name":"migrate-state","children":[{"name":"create_script_for_terraform_state_mv.sh","path":".patcher/patches/v0.14.0/migrate-state/create_script_for_terraform_state_mv.sh","sha":"38b6bf438e1961cd3eeb16f9c52e480bc31df63e"},{"name":"patch.yaml","path":".patcher/patches/v0.14.0/migrate-state/patch.yaml","sha":"451f5fd7eb11feb9d53afb913103668b55b99021"}]}]},{"name":"v0.15.0","children":[{"name":"iam-inline-policies","children":[{"name":"patch.yaml","path":".patcher/patches/v0.15.0/iam-inline-policies/patch.yaml","sha":"e732d40006c01e3a0c81625005633d28ef566b39"},{"name":"var_use_managed_iam_policies.sh","path":".patcher/patches/v0.15.0/iam-inline-policies/var_use_managed_iam_policies.sh","sha":"05759e303d383f1c099461c222dcd4e07f3f112b"}]}]},{"name":"v0.16.0","children":[{"name":"cloudwatch-log-group","children":[{"name":"manage_cloudwatch_log_group.sh","path":".patcher/patches/v0.16.0/cloudwatch-log-group/manage_cloudwatch_log_group.sh","sha":"847a5ffd0367de63aa0117b76f404dc7aa3e2ac8"},{"name":"patch.yaml","path":".patcher/patches/v0.16.0/cloudwatch-log-group/patch.yaml","sha":"1aee46f3fada174473c3249aac05156159ac76de"}]}]},{"name":"v0.17.0","children":[{"name":"terraform-1.1-upgrade","children":[{"name":"bump_required_version.sh","path":".patcher/patches/v0.17.0/terraform-1.1-upgrade/bump_required_version.sh","sha":"30abb1d075dbc85ce83dc415869de1c9c8560b0d"},{"name":"patch.yaml","path":".patcher/patches/v0.17.0/terraform-1.1-upgrade/patch.yaml","sha":"151598d0d058c97f47066847e8426c4eabb1a6dc"}]}]},{"name":"v0.18.0","children":[{"name":"fix-cloudwatch-aggregation","children":[{"name":"create-lambda-cloudwatch-fix-script.sh","path":".patcher/patches/v0.18.0/fix-cloudwatch-aggregation/create-lambda-cloudwatch-fix-script.sh","sha":"ca12646e964ea2a82e1529f6f55921ec96c25c9a"},{"name":"patch.yaml","path":".patcher/patches/v0.18.0/fix-cloudwatch-aggregation/patch.yaml","sha":"fe36a8f10342a50a21802594f1e4f9bd3c1cffce"}]}]}]}]},{"name":".pre-commit-config.yaml","path":".pre-commit-config.yaml","sha":"49ee828ed16f55335ac4dcc74331f190366b1858"},{"name":"CODEOWNERS","path":"CODEOWNERS","sha":"70e040248a707df97162f4607621dcbb99fdc689"},{"name":"LICENSE.txt","path":"LICENSE.txt","sha":"f4e3d9bd4717a044ed31ad847a300eee74371a78"},{"name":"README.md","path":"README.md","sha":"925a2b1dac522baa4a8e183c9f450cab8235a19b"},{"name":"_docs","children":[{"name":"serverless-architecture.png","path":"_docs/serverless-architecture.png","sha":"b08ab629692424a68c403f89e055e9a1d21d05b5"},{"name":"serverless-v2-architecture.png","path":"_docs/serverless-v2-architecture.png","sha":"2be3ebba1ce76e560e62701a6cd11ae98739263d"}]},{"name":"codegen","children":[{"name":"README.adoc","path":"codegen/README.adoc","sha":"56359f9b68cb3226e38c4b0e150235e6a36f4e89"},{"name":"generate-all.sh","path":"codegen/generate-all.sh","sha":"d22d323d54b0fd5de469afd77f4eea72aec8643b"},{"name":"generate-multiregion-lambda-edge-log-groups","children":[{"name":".gitignore","path":"codegen/generate-multiregion-lambda-edge-log-groups/.gitignore","sha":"bd18e1dfd67cafdb78c53dbf4b5f37397b68b4e1"},{"name":"main.go","path":"codegen/generate-multiregion-lambda-edge-log-groups/main.go","sha":"6cea15de1170b631741d4e70ef32d01a6e1f8ce8"},{"name":"static","children":[{"name":"README.md","path":"codegen/generate-multiregion-lambda-edge-log-groups/static/README.md","sha":"cae1f4f148744b5a5a3563fbce3f952bfacd78f3"},{"name":"variables.tf","path":"codegen/generate-multiregion-lambda-edge-log-groups/static/variables.tf","sha":"7e7b3a7c55723331585822672b914ffef5ffb6bb"}]},{"name":"template_data.go","path":"codegen/generate-multiregion-lambda-edge-log-groups/template_data.go","sha":"f3a8ff9d9a2e4d4a6247390ea363a83473249325"}]},{"name":"go.mod","path":"codegen/go.mod","sha":"d181d89e49c10bea44fae5ff955718541ec197ea"},{"name":"go.sum","path":"codegen/go.sum","sha":"c923680452fe274f70de1a756253399f9b78d9bf"}]},{"name":"examples","children":[{"name":"api-gateway-account-settings","children":[{"name":"README.md","path":"examples/api-gateway-account-settings/README.md","sha":"19c6f4fce86a3712b3bb3953391af98fe3ebeead"},{"name":"main.tf","path":"examples/api-gateway-account-settings/main.tf","sha":"48f5c37c72b2efb259f1be1ac10467322b8f4ae3"},{"name":"outputs.tf","path":"examples/api-gateway-account-settings/outputs.tf","sha":"0c0df614d567c6467f57640f9b12d03dbe01ace0"},{"name":"variables.tf","path":"examples/api-gateway-account-settings/variables.tf","sha":"361234e5be3ef39caad0ec4043b34871d9bf28f7"}]},{"name":"lambda-build","children":[{"name":"README.md","path":"examples/lambda-build/README.md","sha":"fe4f882634a3ab8381de4f84da8c7bb4aa894fa9"},{"name":"main.tf","path":"examples/lambda-build/main.tf","sha":"e930b993aaf7a120894045fb34881525685a199e"},{"name":"outputs.tf","path":"examples/lambda-build/outputs.tf","sha":"28fc5ab8cc109b761b4697e68067f4eefc6ee0dd"},{"name":"python","children":[{"name":"Dockerfile","path":"examples/lambda-build/python/Dockerfile","sha":"9c7e1e7a83f4d13fc7ac75fc45912ad6f6f8eaa8"},{"name":"build.sh","path":"examples/lambda-build/python/build.sh","sha":"bf53f2bdde463e8bd2f1a4f93009ecb1c6c0c206"},{"name":"requirements.txt","path":"examples/lambda-build/python/requirements.txt","sha":"494619b6a805efc388aa6da5a2190809577b002a"},{"name":"src","children":[{"name":"__init.py__","path":"examples/lambda-build/python/src/__init.py__","sha":"1b58820b01935d58928ad905427bd838c5e80123"},{"name":"index.py","path":"examples/lambda-build/python/src/index.py","sha":"d0233c21dc7572caead57e7e60c8d75a13312ea0"},{"name":"test_harness.py","path":"examples/lambda-build/python/src/test_harness.py","sha":"73edf34edf789e6f57b0d8288cedb22ec9d37bc3"}]}]},{"name":"variables.tf","path":"examples/lambda-build/variables.tf","sha":"a3db97ba1c39d962d7c36064206535c618ce4083"}]},{"name":"lambda-dead-letter-queue","children":[{"name":"README.md","path":"examples/lambda-dead-letter-queue/README.md","sha":"72f39bbe39bc65a08502bc566b4806965d98460c"},{"name":"main.tf","path":"examples/lambda-dead-letter-queue/main.tf","sha":"ce1610c335f74dbbba32558bdd12a2bfd917d939"},{"name":"outputs.tf","path":"examples/lambda-dead-letter-queue/outputs.tf","sha":"c9f9f5be8eec0260e59b908a0c64d481522e7435"},{"name":"python","children":[{"name":"index.py","path":"examples/lambda-dead-letter-queue/python/index.py","sha":"fdb82c37d271ffb7c508ea1fb9a465cc6d0cc330"}]},{"name":"variables.tf","path":"examples/lambda-dead-letter-queue/variables.tf","sha":"942b373fd87b2e4f0cdae56b12ae6e678bd88133"}]},{"name":"lambda-docker","children":[{"name":"README.md","path":"examples/lambda-docker/README.md","sha":"7726cb040c1dc4e8bc6c429dfafc7b62718b14b5"},{"name":"main.tf","path":"examples/lambda-docker/main.tf","sha":"4b3fff6aede247729fcac7e2772089b76a76b2d5"},{"name":"outputs.tf","path":"examples/lambda-docker/outputs.tf","sha":"fd9cf755adf2751877e57f671af1d78ae36ff598"},{"name":"secret-reflector-go","children":[{"name":"Dockerfile","path":"examples/lambda-docker/secret-reflector-go/Dockerfile","sha":"0abadc3ce47dc9796245f486610145287216148d"},{"name":"go.mod","path":"examples/lambda-docker/secret-reflector-go/go.mod","sha":"ffcb89e39347fa48257d3575137b92ac6711ade9"},{"name":"go.sum","path":"examples/lambda-docker/secret-reflector-go/go.sum","sha":"ba3f7cd243bbd46b0da1ad66499d840a92418038"},{"name":"main.go","path":"examples/lambda-docker/secret-reflector-go/main.go","sha":"e14e06f6d93b863192d9f8acea7121afc72e90a7"}]},{"name":"secret-reflector-python","children":[{"name":"Dockerfile","path":"examples/lambda-docker/secret-reflector-python/Dockerfile","sha":"13d698d74d56eddd7fa59946c6244bb5ee715b91"},{"name":"handler.py","path":"examples/lambda-docker/secret-reflector-python/handler.py","sha":"8e706c47f17f1c3f4c9a11aa45f7c0a56cc32d2a"}]},{"name":"variables.tf","path":"examples/lambda-docker/variables.tf","sha":"b005f0c886386308c4d10c6d3ca3f0c5cd434a44"}]},{"name":"lambda-edge","children":[{"name":"README.md","path":"examples/lambda-edge/README.md","sha":"7ecf6501755d2ec56e07db46941d548a0f154f66"},{"name":"main.tf","path":"examples/lambda-edge/main.tf","sha":"4d1bbbddc2a623f2359d1f3bfd4d3cbb6de623ed"},{"name":"nodejs","children":[{"name":"index.js","path":"examples/lambda-edge/nodejs/index.js","sha":"927b0d194260ca2517369f584a0b49513433f8e9"}]},{"name":"outputs.tf","path":"examples/lambda-edge/outputs.tf","sha":"a4bf8ccab56344ee8953866ff7b16b3f95039e00"},{"name":"providers.tf","path":"examples/lambda-edge/providers.tf","sha":"59fc0b15fd9156b502b68d7bf37d6887d3d9ca37"},{"name":"variables.tf","path":"examples/lambda-edge/variables.tf","sha":"3d51b293e9c1f76e2ee96709bb10abca503fb071"}]},{"name":"lambda-http-api-gateway","children":[{"name":"README.md","path":"examples/lambda-http-api-gateway/README.md","sha":"840459b87e0d1cc60abe0e71f82c6026ae809b5d"},{"name":"echo-text","children":[{"name":"handler.py","path":"examples/lambda-http-api-gateway/echo-text/handler.py","sha":"4c2f6a1cb20486e5cbb923f5be0cd220341cad62"}]},{"name":"main.tf","path":"examples/lambda-http-api-gateway/main.tf","sha":"ed423890e57dcd8392beda23b7fadf756f254c51"},{"name":"outputs.tf","path":"examples/lambda-http-api-gateway/outputs.tf","sha":"6cc8e162e3777368e37d5bc3822032e919ef3644"},{"name":"variables.tf","path":"examples/lambda-http-api-gateway/variables.tf","sha":"e6b3b51c20f780f6808ced14029c7b5d5371b6fe"}]},{"name":"lambda-keep-warm","children":[{"name":"README.md","path":"examples/lambda-keep-warm/README.md","sha":"4ecaf10e050f8db32efe25312488a14576f823b9"},{"name":"main.tf","path":"examples/lambda-keep-warm/main.tf","sha":"04f9ca66a7f5b7bb381317230b906c0c48420f3f"},{"name":"outputs.tf","path":"examples/lambda-keep-warm/outputs.tf","sha":"62a79ed810f3cde44b54d91505647e358752ff4a"},{"name":"src","children":[{"name":"index.js","path":"examples/lambda-keep-warm/src/index.js","sha":"a06e3ce1dddfe2692eeb5b2606873affc975bb76"}]},{"name":"variables.tf","path":"examples/lambda-keep-warm/variables.tf","sha":"1409b361ac77a8a5c64868de4dc06c716f2dcf66"}]},{"name":"lambda-s3-deployment-package","children":[{"name":"README.md","path":"examples/lambda-s3-deployment-package/README.md","sha":"64a77b0a6c5dba92b94fa0f4cdbcb49766591f66"},{"name":"main.tf","path":"examples/lambda-s3-deployment-package/main.tf","sha":"884cbde8ec9865061c702e55ddbd90559ce1ab60"},{"name":"outputs.tf","path":"examples/lambda-s3-deployment-package/outputs.tf","sha":"28fc5ab8cc109b761b4697e68067f4eefc6ee0dd"},{"name":"python","children":[{"name":"index.py","path":"examples/lambda-s3-deployment-package/python/index.py","sha":"eaa4418c2160ad4c4d3af22db1486792e6fee11f"},{"name":"test_harness.py","path":"examples/lambda-s3-deployment-package/python/test_harness.py","sha":"6c8f8c4c4a9ac1aedd12a5e0babae588565d22b4"}]},{"name":"variables.tf","path":"examples/lambda-s3-deployment-package/variables.tf","sha":"c21f2df459e0775158faa1dd9e86cb0666d688c4"}]},{"name":"lambda-s3","children":[{"name":"README.md","path":"examples/lambda-s3/README.md","sha":"fa6d2c51786ccf822b40d3f43cd89177c3c886ce"},{"name":"images","children":[{"name":"gruntwork-logo.png","path":"examples/lambda-s3/images/gruntwork-logo.png","sha":"a351cbef55bb12a9aa2652469416a388e9e276de"}]},{"name":"main.tf","path":"examples/lambda-s3/main.tf","sha":"5c38d0f3b63de09e07f7dfa563772ec5346c8b25"},{"name":"outputs.tf","path":"examples/lambda-s3/outputs.tf","sha":"729892970d1ffc9122cef114133614945b9c7853"},{"name":"python","children":[{"name":"index.py","path":"examples/lambda-s3/python/index.py","sha":"9382fa2e2c3956f1c5ae1467de0f3942cad5bf34"},{"name":"test_harness.py","path":"examples/lambda-s3/python/test_harness.py","sha":"723f97fdacc7155bac0a3d9e12715a7bd6ba6c41"}]},{"name":"variables.tf","path":"examples/lambda-s3/variables.tf","sha":"abc518949b9d570263e8614834b0005aa58b40b9"}]},{"name":"lambda-service","children":[{"name":"app","children":[{"name":"app.js","path":"examples/lambda-service/app/app.js","sha":"faa4e1eef6ec837604c14a9629f6160a6e1c4b55"},{"name":"lambda.js","path":"examples/lambda-service/app/lambda.js","sha":"ee16375dac8d77ea09aed18a39bd6fdbd6aa5617"},{"name":"package-lock.json","path":"examples/lambda-service/app/package-lock.json","sha":"b03ed12db320f026e2fbae196732a7e0308f677c"},{"name":"package.json","path":"examples/lambda-service/app/package.json","sha":"0846df06aefae385cf8fa739e9f49e63fcff5bd9"}]},{"name":"edge","children":[{"name":"README.md","path":"examples/lambda-service/edge/README.md","sha":"c14b205d4d90fbdb6c82593d40fee332ffcde71e"},{"name":"main.tf","path":"examples/lambda-service/edge/main.tf","sha":"1647c0f207a62e3ea3411b0a364b802f0a2444ad"},{"name":"outputs.tf","path":"examples/lambda-service/edge/outputs.tf","sha":"4b25a3b03b793405c471061c9846f7e72be702b2"},{"name":"variables.tf","path":"examples/lambda-service/edge/variables.tf","sha":"56a26610f6fedfa2b6a7fef86024cf210e5a13cc"}]},{"name":"path-routing-with-catchall","children":[{"name":"README.md","path":"examples/lambda-service/path-routing-with-catchall/README.md","sha":"6dadf1f59d9114ce6f772204062921b3c7d02e72"},{"name":"main.tf","path":"examples/lambda-service/path-routing-with-catchall/main.tf","sha":"127adf9eb444ddb05af4e71b8470c1949df949df"},{"name":"outputs.tf","path":"examples/lambda-service/path-routing-with-catchall/outputs.tf","sha":"372fb177a6b33e440dfa397535f7c3a687b20e11"},{"name":"variables.tf","path":"examples/lambda-service/path-routing-with-catchall/variables.tf","sha":"3cb449136019e51d4d7671fd89384832d5e09e04"}]},{"name":"path-routing","children":[{"name":"README.md","path":"examples/lambda-service/path-routing/README.md","sha":"56dca58e89d6218992af22d948d022e8ce0d3639"},{"name":"main.tf","path":"examples/lambda-service/path-routing/main.tf","sha":"39007095a004be2c3fa6ffc8ef3c3ea3bc59a0e3"},{"name":"outputs.tf","path":"examples/lambda-service/path-routing/outputs.tf","sha":"372fb177a6b33e440dfa397535f7c3a687b20e11"},{"name":"variables.tf","path":"examples/lambda-service/path-routing/variables.tf","sha":"3cb449136019e51d4d7671fd89384832d5e09e04"}]},{"name":"regional","children":[{"name":"README.md","path":"examples/lambda-service/regional/README.md","sha":"8d7d29aef2a233f9b207b07ce6e75b0192a84cf9"},{"name":"main.tf","path":"examples/lambda-service/regional/main.tf","sha":"8dd1d9cf8284c353a4cc2c2d4afe4b0def84154c"},{"name":"outputs.tf","path":"examples/lambda-service/regional/outputs.tf","sha":"4b25a3b03b793405c471061c9846f7e72be702b2"},{"name":"variables.tf","path":"examples/lambda-service/regional/variables.tf","sha":"56a26610f6fedfa2b6a7fef86024cf210e5a13cc"}]}]},{"name":"lambda-vpc","children":[{"name":"README.md","path":"examples/lambda-vpc/README.md","sha":"06061feff46330251b227af179d79d2d78dfde3c"},{"name":"javascript","children":[{"name":"index.js","path":"examples/lambda-vpc/javascript/index.js","sha":"1c4d37c47144c12acaa1306952c6e8512b201744"}]},{"name":"main.tf","path":"examples/lambda-vpc/main.tf","sha":"88d0ea9e728a7607c886c11b7aec218353ea08f2"},{"name":"outputs.tf","path":"examples/lambda-vpc/outputs.tf","sha":"eb9cbc764168459df0fa63742281ef87b5919f2e"},{"name":"variables.tf","path":"examples/lambda-vpc/variables.tf","sha":"17ee714bfd63e99dc13f625e88cca231e4e47a78"}]},{"name":"scheduled-lambda-job","children":[{"name":"README.md","path":"examples/scheduled-lambda-job/README.md","sha":"d106b5f0e85f490b4c232d5f9cb943fbca266fcc"},{"name":"javascript","children":[{"name":"index.js","path":"examples/scheduled-lambda-job/javascript/index.js","sha":"92e0906a7d45397aedbda160a61f50321f7c23e4"}]},{"name":"main.tf","path":"examples/scheduled-lambda-job/main.tf","sha":"feb8e1ced1082d1faa1a9c4067c956c392a00e7d"},{"name":"outputs.tf","path":"examples/scheduled-lambda-job/outputs.tf","sha":"eb9cbc764168459df0fa63742281ef87b5919f2e"},{"name":"variables.tf","path":"examples/scheduled-lambda-job/variables.tf","sha":"d3a08b377cc2cb908fb23af423b1700b19e3a684"}]}]},{"name":"modules","children":[{"name":"api-gateway-account-settings","children":[{"name":"README.md","path":"modules/api-gateway-account-settings/README.md","sha":"ca40e9ffc898348824ab3b183bb23a497860c58e"},{"name":"account-settings.png","path":"modules/api-gateway-account-settings/account-settings.png","sha":"f9e573d320f6d6f0ad0748e0d406589f38d54bd1"},{"name":"main.tf","path":"modules/api-gateway-account-settings/main.tf","sha":"3c8615fe32a8169f602aa0c723a1f42e8f98fdaf"},{"name":"outputs.tf","path":"modules/api-gateway-account-settings/outputs.tf","sha":"ebfd7c838ab30a445df0481c4571ebde61747be0"},{"name":"variables.tf","path":"modules/api-gateway-account-settings/variables.tf","sha":"34ce4c5ec0fc016d293bfbc2b50d0a3c532fb06c"}]},{"name":"api-gateway-proxy-methods","children":[{"name":"README.md","path":"modules/api-gateway-proxy-methods/README.md","sha":"e7438397d279ced3af56c11c78d241bb0ff6dedf"},{"name":"main.tf","path":"modules/api-gateway-proxy-methods/main.tf","sha":"80a016f8598790a77dd8b99f5e32c62e747a4b81"},{"name":"outputs.tf","path":"modules/api-gateway-proxy-methods/outputs.tf","sha":"c09e327abb5ba52aa563199f254ec54ee368c647"},{"name":"variables.tf","path":"modules/api-gateway-proxy-methods/variables.tf","sha":"831b1015342bdff3e4567b7b7d52c099981873b9"}]},{"name":"api-gateway-proxy","children":[{"name":"README.md","path":"modules/api-gateway-proxy/README.md","sha":"90399bb539a78ebd32de19b9f134d0d88bfadcf4"},{"name":"core-concepts.md","path":"modules/api-gateway-proxy/core-concepts.md","sha":"4400e3a78f955b119662d9e809b30fde52967f0b"},{"name":"main.tf","path":"modules/api-gateway-proxy/main.tf","sha":"b8437288ef1b263db3037a13faa547bfde263352"},{"name":"outputs.tf","path":"modules/api-gateway-proxy/outputs.tf","sha":"ceb7718363eaa90c50c910967e3a273689ea4a2b"},{"name":"variables.tf","path":"modules/api-gateway-proxy/variables.tf","sha":"537dbfffc1f88cdee612bbf0aa663a52a7c42d74"}]},{"name":"keep-warm","children":[{"name":"README.md","path":"modules/keep-warm/README.md","sha":"1285d2927ca0614e0b4725ca6185629820e98488"},{"name":"main.tf","path":"modules/keep-warm/main.tf","sha":"7f50995118e042775d06d0313d2f5d298dc56463"},{"name":"outputs.tf","path":"modules/keep-warm/outputs.tf","sha":"5fc4667c38e2694986e16b9808e9957ec0ad5d5b"},{"name":"src","children":[{"name":"index.js","path":"modules/keep-warm/src/index.js","sha":"16c923525b669ef04cfb039349ad6dd906720caa"}]},{"name":"variables.tf","path":"modules/keep-warm/variables.tf","sha":"0ab3e1387cc0f345a10b8d8b6a5f09d540337bb9"}]},{"name":"lambda-edge-log-group","children":[{"name":"README.md","path":"modules/lambda-edge-log-group/README.md","sha":"08f2155c6532fef5c8623afc6c05422bd7b245fc"},{"name":"main.tf","path":"modules/lambda-edge-log-group/main.tf","sha":"73bcd6c9b71570a95c13096bc194ff8aee946a29"},{"name":"outputs.tf","path":"modules/lambda-edge-log-group/outputs.tf","sha":"8fd18267ef3b451d7c1e31294b9d607cddc67cbb"},{"name":"variables.tf","path":"modules/lambda-edge-log-group/variables.tf","sha":"48346e3e00f6bb88bd17865b155f9c094eb4921d"}]},{"name":"lambda-edge-multi-region-log-groups","children":[{"name":"README.md","path":"modules/lambda-edge-multi-region-log-groups/README.md","sha":"b426a7c07d2ab1b7632239629713fb9649a8540c"},{"name":"main.tf","path":"modules/lambda-edge-multi-region-log-groups/main.tf","sha":"601fcfe6b9433b5e9c06f2443a578112a9a1f5ce"},{"name":"outputs.tf","path":"modules/lambda-edge-multi-region-log-groups/outputs.tf","sha":"2ba9b4ae50dfd245b3837dd9fe91191d99ada851"},{"name":"variables.autogen.tf","path":"modules/lambda-edge-multi-region-log-groups/variables.autogen.tf","sha":"d052c298686be4693fe259e39ddadb09bd65a613"},{"name":"variables.tf","path":"modules/lambda-edge-multi-region-log-groups/variables.tf","sha":"7e7b3a7c55723331585822672b914ffef5ffb6bb"}]},{"name":"lambda-edge","children":[{"name":"README.md","path":"modules/lambda-edge/README.md","sha":"4550c1210b122a712ffaa1b41c635a2f0ea950bc","toggled":true},{"name":"main.tf","path":"modules/lambda-edge/main.tf","sha":"1588b1d3f2d26be03a31e6778a1707a7cde94817"},{"name":"outputs.tf","path":"modules/lambda-edge/outputs.tf","sha":"62294b0704c9692af9d7a6b6568689287ae68913"},{"name":"variables.tf","path":"modules/lambda-edge/variables.tf","sha":"81ffc02ffc2711fb8d8ab6c2c97e4e0d659b41ec"}],"toggled":true},{"name":"lambda-http-api-gateway","children":[{"name":"README.md","path":"modules/lambda-http-api-gateway/README.md","sha":"6cffb4f28367af1594b36399b4821604cb81bfd8"},{"name":"main.tf","path":"modules/lambda-http-api-gateway/main.tf","sha":"a220d60ea444d669bbd34ed9c2091a86b8650b94"},{"name":"outputs.tf","path":"modules/lambda-http-api-gateway/outputs.tf","sha":"2231d638d272e900fa399d8304619efe55265b47"},{"name":"variables.tf","path":"modules/lambda-http-api-gateway/variables.tf","sha":"8dd28898ef84c1f09641c91bf33f4e8051dacc91"}]},{"name":"lambda","children":[{"name":"README.md","path":"modules/lambda/README.md","sha":"5ba16ffa6cc082720cc71eb839f2051077f334b3"},{"name":"eni-cleanup","children":[{"name":"eni-cleanup.sh","path":"modules/lambda/eni-cleanup/eni-cleanup.sh","sha":"4046f21257cbd4d40a770776c5d6a96d1a6c5784"}]},{"name":"main.tf","path":"modules/lambda/main.tf","sha":"6a5718f8a177ddde454d38866cb12bfca540d472"},{"name":"outputs.tf","path":"modules/lambda/outputs.tf","sha":"7cce4e145c81002ea12de6239a9f27ae8ccb7c24"},{"name":"variables.tf","path":"modules/lambda/variables.tf","sha":"e3168d11e181a364caf388e6b34385251e9bb012"}]},{"name":"run-lambda-entrypoint","children":[{"name":"README.md","path":"modules/run-lambda-entrypoint/README.md","sha":"c90ed41b9dc9f09e30efaab978aa542bc65b2210"},{"name":"go.mod","path":"modules/run-lambda-entrypoint/go.mod","sha":"7dfee2e63d9c2872a39dc75448cf90f5adbd0c22"},{"name":"go.sum","path":"modules/run-lambda-entrypoint/go.sum","sha":"2524e82c69811fb5f557166f7728e1c2de2201e4"},{"name":"install.sh","path":"modules/run-lambda-entrypoint/install.sh","sha":"5d901d594515bffac9e25ac780c0ea4fc9ffd561"},{"name":"main.go","path":"modules/run-lambda-entrypoint/main.go","sha":"57c70efca461e66c29d76a55b4fbb78788798fa1"}]},{"name":"scheduled-lambda-job","children":[{"name":"README.md","path":"modules/scheduled-lambda-job/README.md","sha":"f229fe1c35b2ca0eca42971bc8976c7a24e03aa6"},{"name":"main.tf","path":"modules/scheduled-lambda-job/main.tf","sha":"6621ca8542ae9f01dded84111d08cea953510c22"},{"name":"outputs.tf","path":"modules/scheduled-lambda-job/outputs.tf","sha":"63274208aa97eceb03826f154973e010b1e8c539"},{"name":"variables.tf","path":"modules/scheduled-lambda-job/variables.tf","sha":"30b33e21aa04c3887ba042491e4d70da83b75557"}]}],"toggled":true},{"name":"owners.txt","path":"owners.txt","sha":"bc3c9b6136485d9fa12b39f55b2ebbdeaa03583f"},{"name":"terraform-cloud-enterprise-private-module-registry-placeholder.tf","path":"terraform-cloud-enterprise-private-module-registry-placeholder.tf","sha":"ae586c0fe830819580e1009d41a9074f16e65bed"},{"name":"test","children":[{"name":"README.md","path":"test/README.md","sha":"f798bda8aed01240778826ec33d91a059f52acde"},{"name":"api_gateway_account_settings_test.go","path":"test/api_gateway_account_settings_test.go","sha":"4cbc2475fcc73a526eb35d745f187e04e7056e85"},{"name":"go.mod","path":"test/go.mod","sha":"011427c2898521fe6a4002e3eb7048d0e23ecdd1"},{"name":"go.sum","path":"test/go.sum","sha":"424b6a43b6eb52b117a5e1e85491958b7d88477a"},{"name":"gruntwork-logo.base64.txt","path":"test/gruntwork-logo.base64.txt","sha":"e94e107e3a8ea8c875a4489071137a38d279dc10"},{"name":"helpers.go","path":"test/helpers.go","sha":"ca1637742be564d3c22c96cd8e9e40f83e842953"},{"name":"lambda_build_test.go","path":"test/lambda_build_test.go","sha":"284ed155e95097334426ba6fb4f1fc669bb775c2"},{"name":"lambda_dead_letter_queue_test.go","path":"test/lambda_dead_letter_queue_test.go","sha":"3145c3ef1257c29cc9a460d69a95924fb1b2a441"},{"name":"lambda_docker_test.go","path":"test/lambda_docker_test.go","sha":"2e1fca344043531bddc05ddebaf3216a29748d04"},{"name":"lambda_edge_test.go","path":"test/lambda_edge_test.go","sha":"6e777042e0c03f61f72ea46bbd902bfd504d9d0e"},{"name":"lambda_http_api_gateway_test.go","path":"test/lambda_http_api_gateway_test.go","sha":"74af3105ac41d053ffeea68c85d6c0491a2d7eeb"},{"name":"lambda_keep_warm_test.go","path":"test/lambda_keep_warm_test.go","sha":"045939ca6431bced95d37822e42a1294a0504590"},{"name":"lambda_s3_deployment_package_test.go","path":"test/lambda_s3_deployment_package_test.go","sha":"5a7f0de5d6f121aa3b2e33d6ad729e737da9f674"},{"name":"lambda_s3_reserved_test.go","path":"test/lambda_s3_reserved_test.go","sha":"62f81d1f78b6d10eb32e5bc2c6d5fedaf1803cf2"},{"name":"lambda_s3_test.go","path":"test/lambda_s3_test.go","sha":"212fc05ec22552e1b3b9ce74c216f8ad35dd828f"},{"name":"lambda_service_test.go","path":"test/lambda_service_test.go","sha":"1ad6fe33e5d557fb70f98fd1ed80938ffdc8933c"},{"name":"lambda_vpc_test.go","path":"test/lambda_vpc_test.go","sha":"1070caac685fc019590a90b15480f9806c20f29d"},{"name":"scheduled_lambda_job_test.go","path":"test/scheduled_lambda_job_test.go","sha":"fe5de2c46d2b3c5b88714036195e61d39ff18cbd"},{"name":"upgrades","children":[{"name":"upgrade_test.go","path":"test/upgrades/upgrade_test.go","sha":"42df9ce1677ce6de2b0fc0c9b973499ef56d6200"}]},{"name":"validation","children":[{"name":"validate_all_modules_and_examples_test.go","path":"test/validation/validate_all_modules_and_examples_test.go","sha":"918793390f1c56e1961fabfc6747054bd95089f7"}]}]}]},"detailsContent":"<h1 class=\"preview__body--title\" id=\"lambda-edge-function-module\">Lambda@Edge Function Module</h1><div class=\"preview__body--border\"></div><p>This module makes it easy to deploy and manage an <a href=\"https://aws.amazon.com/lambda/edge/\" class=\"preview__body--description--blue\" target=\"_blank\">AWS Lambda@Edge</a> function.\nLambda@Edge gives you a way to run code on-demand in AWS Edge locations without having to manage servers.</p>\n<p>Lambda@Edge has the following limitations compared to regular Lambda (see\n<a href=\"https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html\" class=\"preview__body--description--blue\" target=\"_blank\">the CloudFront Developer Guide</a>\nfor the full details):</p>\n<ul>\n<li>The functions must not have any environment variables.</li>\n<li>The execution timeout must not be higher than 30 seconds.</li>\n<li>The function must be versioned in order to be a target for Cloudfront events.</li>\n<li>The function must be deployed in the <code>us-east-1</code> region.</li>\n<li>The function runtime must be one of:\n<ul>\n<li><code>nodejs10.x</code> or newer</li>\n<li><code>python3.7</code> or newer</li>\n</ul>\n</li>\n</ul>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-you-use-this-module\">How do you use this module?</h2>\n<ul>\n<li>See the <a href=\"/repos/v0.21.3/package-lambda/README.md\" class=\"preview__body--description--blue\">root README</a> for instructions on using Terraform modules.</li>\n<li>See the <a href=\"/repos/v0.21.3/package-lambda/examples/lambda-edge\" class=\"preview__body--description--blue\">lambda-edge example</a> folder for sample usage.</li>\n<li>See <a href=\"/repos/v0.21.3/package-lambda/modules/lambda-edge/variables.tf\" class=\"preview__body--description--blue\">variables.tf</a> for all the variables you can set on this module.</li>\n</ul>\n<p>The general idea is to:</p>\n<ol>\n<li>Create a folder that contains your source code in one of the supported languages: Python, JavaScript, Java, etc (see\n<a href=\"https://docs.aws.amazon.com/lambda/latest/dg/programming-model-v2.html\" class=\"preview__body--description--blue\" target=\"_blank\">Lambda programming model</a> for the complete\nlist).</li>\n<li>Use this <code>lambda-edge</code> module to automatically zip that folder, upload it to AWS, and configure it as a Lambda function.</li>\n<li>Trigger your Lambda function using one of the following options:\n<ol>\n<li><a href=\"https://console.aws.amazon.com/lambda/home\" class=\"preview__body--description--blue\" target=\"_blank\">AWS Console UI</a>.</li>\n<li><a href=\"http://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html\" class=\"preview__body--description--blue\" target=\"_blank\">AWS API</a>.</li>\n<li><a href=\"http://docs.aws.amazon.com/cli/latest/reference/lambda/invoke.html\" class=\"preview__body--description--blue\" target=\"_blank\">AWS CLI</a>.</li>\n<li><a href=\"http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html\" class=\"preview__body--description--blue\" target=\"_blank\">API Gateway</a> API you expose.</li>\n<li>An <a href=\"http://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html\" class=\"preview__body--description--blue\" target=\"_blank\">event source</a>, such as a new\nCloudfront event.</li>\n</ol>\n</li>\n</ol>\n<h2 class=\"preview__body--subtitle\" id=\"what-is-aws-lambda\">What is AWS Lambda?</h2>\n<p><a href=\"https://aws.amazon.com/lambda/\" class=\"preview__body--description--blue\" target=\"_blank\">AWS Lambda</a> lets you run code without provisioning or managing servers. You define a\nfunction in a supported language (currently: Python, JavaScript, Java, and C#), upload the code to Lambda, specify how\nthat function can be triggered, and then AWS Lambda takes care of all the details of deploying and scaling the\ninfrastructure to run that code.</p>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-you-add-additional-iam-policies-and-permissions\">How do you add additional IAM policies and permissions?</h2>\n<p>By default, the <code>lambda-edge</code> module configures your lambda function with an IAM role that allows it to write logs to\nCloudWatch Logs. The ID of the IAM role is exported as the output <code>iam_role_id</code> and the ID of the lambda function is\nexported as the output <code>function_arn</code>, so you can add custom rules using the <code>aws_iam_role_policy</code> or\n<code>aws_lambda_permission</code> resources, respectively. For example, to allow your lambda function to be triggered by SNS:</p>\n<pre><span class=\"hljs-keyword\">module</span> <span class=\"hljs-string\">\"my_lambda_function\"</span> {\n source = <span class=\"hljs-string\">\"git::git@github.com:gruntwork-io/terraform-aws-lambda.git//modules/lambda-edge?ref=v1.0.8\"</span>\n <span class=\"hljs-comment\"># (params omitted)</span>\n}\n\n<span class=\"hljs-keyword\">resource</span> <span class=\"hljs-string\">\"aws_lambda_permission\"</span> <span class=\"hljs-string\">\"with_sns\"</span> {\n statement_id = <span class=\"hljs-string\">\"AllowExecutionFromSNS\"</span>\n action = <span class=\"hljs-string\">\"lambda:InvokeFunction\"</span>\n function_name = <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${module.my_lambda_function.function_arn}</span>\"</span>\n principal = <span class=\"hljs-string\">\"sns.amazonaws.com\"</span>\n source_arn = <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${aws_sns_topic.default.arn}</span>\"</span>\n}\n</pre>\n<h2 class=\"preview__body--subtitle\" id=\"how-to-get-the-logs-of-your-function\">How to get the logs of your function</h2>\n<p>Lambda@Edge stores CloudWatch Logs in the AWS Regions closest to the location where the function receives traffic and is\nexecuted. That means a log group must be created in every region that have <a href=\"https://aws.amazon.com/blogs/networking-and-content-delivery/aggregating-lambdaedge-logs/\" class=\"preview__body--description--blue\" target=\"_blank\">Regional Edge Caches</a>.\nInstructions on how to do this can be found at the <a href=\"/repos/v0.21.3/package-lambda/modules/lambda-edge-multi-region-log-groups\" class=\"preview__body--description--blue\"><code>lambda-edge-multi-region-log-groups</code> module</a>. To see which regions are receiving traffic, you can find graphs of metrics for the\nfunction on the CloudFront console and choose your region there.</p>\n<h2 class=\"preview__body--subtitle\" id=\"how-to-trigger-this-lambda-function-from-cloudfront\">How to trigger this Lambda function from Cloudfront</h2>\n<p>This module deploys the Lambda function but doesn't create any CloudFront trigger. There are two ways to create those\ntriggers:</p>\n<ol>\n<li>Using terraform. To link the Lambda@Edge function to the <a href=\"/repos/terraform-aws-static-assets/modules/s3-cloudfront\" class=\"preview__body--description--blue\">s3-cloudfront module from\nterraform-aws-static-assets</a>,\nyou can use the\n<a href=\"/repos/terraform-aws-static-assets/modules/s3-cloudfront/variables.tf#L308\" class=\"preview__body--description--blue\">default_lambda_associations</a>\ninput variable.</li>\n<li>Manually from the AWS Console as described in the\n<a href=\"https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html#lambda-edge-add-triggers\" class=\"preview__body--description--blue\" target=\"_blank\">Lambda@Edge documentation</a></li>\n</ol>\n","repoName":"package-lambda","repoRef":"v0.21.2","serviceDescriptor":{"serviceName":"AWS Lambda","serviceRepoName":"package-lambda","serviceRepoOrg":"gruntwork-io","cloudProviders":["aws"],"description":"Deploy Lambda functions with Terraform. Supports uploading deployment packages, configuring environment variables, and scheduled functions.","imageUrl":"lambda.png","licenseType":"subscriber","technologies":["Terraform","Bash"],"compliance":[],"tags":[""]},"serviceCategoryName":"Serverless","fileName":"README.md","filePath":"/modules/lambda-edge","title":"Repo Browser: AWS Lambda","description":"Browse the repos in the Gruntwork Infrastructure as Code Library."}