Skip to content

Instantly share code, notes, and snippets.

@thanakijwanavit
Created February 8, 2023 04:41
Show Gist options
  • Save thanakijwanavit/ae4e56fc73f2460e95d695caef1e3f60 to your computer and use it in GitHub Desktop.
Save thanakijwanavit/ae4e56fc73f2460e95d695caef1e3f60 to your computer and use it in GitHub Desktop.
keep lambda function warm in sam template
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
WarmFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src
Handler: index.handler
Runtime: python3.8
Events:
WarmUpEvent:
Type: Schedule
Properties:
Schedule: rate(5 minutes)
Enabled: true
Input: '{"query":"warm"}'
Environment:
Variables:
LOG_LEVEL: INFO
Outputs:
WarmFunctionName:
Description: The name of the warm function
Value: !Ref WarmFunction
Export:
Name: WarmFunctionName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment