Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mununki/lambda-warmer
A lambda function to warm another lambda function
https://github.com/mununki/lambda-warmer
Last synced: 10 days ago
JSON representation
A lambda function to warm another lambda function
- Host: GitHub
- URL: https://github.com/mununki/lambda-warmer
- Owner: mununki
- Created: 2019-04-11T14:31:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-11T14:45:25.000Z (over 5 years ago)
- Last Synced: 2024-04-24T03:22:04.505Z (8 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lambda Warmer
_The related post: https://moondaddi.dev/post/2019-03-23-how-to-warm-lambda-function/_
This is a lambda function to warm another lambda function in AWS. Especially, this is to solve a cold start issue for **the web app which is deployed on AWS lambda.**
## Usage
### Requirements
- [serverless](https://serverless.com/) is required.
### Deployment
- Clone this repo.
```shell
$ git clone https://github.com/mattdamon108/lambda-warmer.git
```- Rename `serverless.template.yml` to `serverless.yml` and configure it with your IAM profile.
```shell
$ mv serverless.template.yml serverless.yml
``````yml
service: lambda-warmerprovider:
name: aws
runtime: nodejs8.10
stage: dev
region: ap-northeast-2 # Edit the region
profile: your-profile # Edit here with your AWS IAM profile
memorySize: 128
timeout: 15sfunctions:
warmer:
handler: handler.warmer
events:
- schedule: rate(5 minutes)
```> Your IAM profile needs to be stored in `~/.aws/credentials` with proper permissions to create a lambda function through AWS cloudformation.
- Set the target URL
```js
// handler.jsmodule.exports.warmer = async (event, context, callback) => {
try {
await warming("https://www.rate-link.com/rates"); // change your target URL
context.succeed();
} catch (e) {
context.done();
}
};
```- Deploy
```shell
$ sls deploy
```