https://github.com/krishanthisera/aws-edge-functions
This repository is a Terraform sub-module designed for use with the AWS Static Hosting module. Its primary purpose is to deploy Lambda@Edge functions for prerender integration with CloudFront. Enhance page loading speed and search engine indexing for SPAs and dynamic web applications.
https://github.com/krishanthisera/aws-edge-functions
cdn cloudfront edge-computing iac lambda-functions prerender s3 spacelift static-site terraform typescript
Last synced: 27 days ago
JSON representation
This repository is a Terraform sub-module designed for use with the AWS Static Hosting module. Its primary purpose is to deploy Lambda@Edge functions for prerender integration with CloudFront. Enhance page loading speed and search engine indexing for SPAs and dynamic web applications.
- Host: GitHub
- URL: https://github.com/krishanthisera/aws-edge-functions
- Owner: krishanthisera
- Created: 2023-07-21T00:52:57.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-24T07:29:20.000Z (almost 3 years ago)
- Last Synced: 2025-01-07T11:50:03.800Z (over 1 year ago)
- Topics: cdn, cloudfront, edge-computing, iac, lambda-functions, prerender, s3, spacelift, static-site, terraform, typescript
- Language: TypeScript
- Homepage:
- Size: 114 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AWS Edge Functions - Terraform Sub-Module
This repository serves as a Terraform sub-module designed for use with the AWS Static Hosting module. The primary purpose of this module is to deploy a set of Lambda@Edge functions that provide prerender integration for CloudFront. This enables faster page loading and improved search engine indexing for Single Page Applications (SPAs) and other dynamic web applications.
## Usage
To use this module in your Terraform configuration, simply add the following code:
```hcl
module "edge-functions" {
source = "github.com/krishanthisera/aws-edge-functions.git"
}
```
After adding the module, run `terraform init` to initialize your configuration.
## Technologies Used
This module is built using the following technologies and tools:
- Terraform: Infrastructure as Code (IaC) tool used to manage AWS resources.
- TypeScript: Language used to write the Lambda@Edge functions.
- turbo-repo: A tool used for repository management and monorepo setups.
- esbuild: Used to bundle the TypeScript code and set environment variables during the build process.
## How to Use as a Terraform Module
To use this repository as a Terraform module, you can refer to the example provided in the [AWS Static Hosting repository](https://github.com/krishanthisera/aws-static-hosting/tree/main). It showcases how to integrate this module to enable prerendering with CloudFront.
## Prerender Integration
The deployed Lambda@Edge functions work in conjunction with CloudFront to perform prerendering. This means that when a request is made to CloudFront for a page of your SPA (from a crawler), the Lambda@Edge functions will leverage prerender service to generate a prerendered version of the page and serve it to the user. This leads to improved page loading times and better SEO performance.
## Handling Environment Variables
As you are not able to set environment variables at runtime for the Lambda@Edge functions, during the build process, esbuild is used to configure the necessary environment variables and bundle them into the build artifacts.
## How to Contribute
Contributions to this project are welcome! If you have any bug reports, feature requests, or improvements to suggest, you can do so by creating a pull request or opening an issue. Your feedback is highly valuable to us, and we appreciate any contributions made to enhance this module.
## Contact
If you have any questions or need further assistance, you can contact the project maintainer by creating an issue in this repository.