Created
April 5, 2022 16:14
-
-
Save thepalbi/5659ad737ee74aa92829fc3d1aacd632 to your computer and use it in GitHub Desktop.
Lambda + Cron CloudFormation template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resources: | |
GrafanaTestFunctionServiceRoleDEDD1AAA: | |
Type: AWS::IAM::Role | |
Properties: | |
AssumeRolePolicyDocument: | |
Statement: | |
- Action: sts:AssumeRole | |
Effect: Allow | |
Principal: | |
Service: lambda.amazonaws.com | |
Version: "2012-10-17" | |
ManagedPolicyArns: | |
- Fn::Join: | |
- "" | |
- - "arn:" | |
- Ref: AWS::Partition | |
- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole | |
GrafanaTestFunction570326C8: | |
Type: AWS::Lambda::Function | |
Properties: | |
Code: | |
ZipFile: " | |
\ exports.handler = async (event) => { | |
\ // TODO implement | |
\ const response = { | |
\ statusCode: 200, | |
\ body: JSON.stringify('Hello from Lambda!'), | |
\ }; | |
\ return response; | |
\ }; | |
\ " | |
Role: | |
Fn::GetAtt: | |
- GrafanaTestFunctionServiceRoleDEDD1AAA | |
- Arn | |
Handler: index.handler | |
Runtime: nodejs14.x | |
Timeout: 60 | |
DependsOn: | |
- GrafanaTestFunctionServiceRoleDEDD1AAA | |
CronRule93635715: | |
Type: AWS::Events::Rule | |
Properties: | |
ScheduleExpression: rate(1 minute) | |
State: ENABLED | |
Targets: | |
- Arn: | |
Fn::GetAtt: | |
- GrafanaTestFunction570326C8 | |
- Arn | |
Id: Target0 | |
CronRuleAllowEventRuleTestLambdaStackGrafanaTestFunctionB0CB893016423275: | |
Type: AWS::Lambda::Permission | |
Properties: | |
Action: lambda:InvokeFunction | |
FunctionName: | |
Fn::GetAtt: | |
- GrafanaTestFunction570326C8 | |
- Arn | |
Principal: events.amazonaws.com | |
SourceArn: | |
Fn::GetAtt: | |
- CronRule93635715 | |
- Arn | |
CDKMetadata: | |
Type: AWS::CDK::Metadata | |
Properties: | |
Analytics: v2:deflate64:H4sIAAAAAAAA/02OQQrCMBBFz+I+Ha2I4LrgWtoDSJqMMG0zgU5SFyF3N40uXL0/78NnztDe4HTQb2mMnZuFRkhD0GZWRT3Tot1oNaR7ZBPIs+pe/J8fuDoSKVdWpB2k3i+4Fzuzwg05SLHxZwtzrgnFx9VU23m2FOoGe4swyXFrr9BeymOTEDVr5EAOof/yA9uCz8i0AAAA | |
Condition: CDKMetadataAvailable | |
Conditions: | |
CDKMetadataAvailable: | |
Fn::Or: | |
- Fn::Or: | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- af-south-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- ap-east-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- ap-northeast-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- ap-northeast-2 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- ap-south-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- ap-southeast-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- ap-southeast-2 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- ca-central-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- cn-north-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- cn-northwest-1 | |
- Fn::Or: | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- eu-central-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- eu-north-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- eu-south-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- eu-west-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- eu-west-2 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- eu-west-3 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- me-south-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- sa-east-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- us-east-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- us-east-2 | |
- Fn::Or: | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- us-west-1 | |
- Fn::Equals: | |
- Ref: AWS::Region | |
- us-west-2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment