Skip to content

New serverless pattern - lambda-web-cloudfront-oac/nodejs/terraform - #3572

Open
mattenarle10 wants to merge 1 commit into
aws-samples:mainfrom
mattenarle10:mattenarle10-feature-lambda-web-cloudfront-oac-terraform
Open

mattenarle10 wants to merge 1 commit into
aws-samples:mainfrom
mattenarle10:mattenarle10-feature-lambda-web-cloudfront-oac-terraform

Conversation

@mattenarle10

Copy link
Copy Markdown

Issue #, if available: N/A

Description of changes:

Adds a Terraform variant to the existing lambda-web-cloudfront-oac family. Terraform packages the Node.js app in versioned S3 storage and creates a regional Lambda Web Function endpoint with IamAuth. CloudFront signs origin requests through OAC, and the endpoint policy grants invocation to the CloudFront service principal for this distribution only.

Tested in ap-northeast-1 with Terraform 1.16.4 and AWS provider 6.72.0. An unsigned request to the origin returned HTTP 403. CloudFront served the app and forwarded a dummy viewer Authorization header without echoing it. Repeated /whoami requests returned different request IDs. Two requests to /cached showed a CloudFront miss followed by a hit with the same body. terraform destroy left empty state, and AWS inventory checks confirmed cleanup.

terraform fmt -check -recursive, terraform validate, both mocked Terraform tests, and the repository's folder, schema, and IAM checks passed.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants