-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cloudwatch events rule for raw sync lambda
- Loading branch information
1 parent
fb220e6
commit 614c478
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
template: | ||
path: events-rule.yaml | ||
stack_name: "{{ stack_group_config.namespace }}-events-rule-raw-sync" | ||
dependencies: | ||
- develop/namespaced/lambda-raw-sync.yaml | ||
parameters: | ||
RuleName: "{{ stack_group_config.namespace }}-lambda-raw-sync-trigger" | ||
RuleState: DISABLED | ||
LambdaArn: !stack_output_external "{{ stack_group_config.namespace }}-lambda-raw-sync::RawSyncFunctionArn" | ||
CronSchedule: cron(0 0 * * ? *) | ||
stack_tags: | ||
{{ stack_group_config.default_stack_tags }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
template: | ||
path: events-rule.yaml | ||
stack_name: "{{ stack_group_config.namespace }}-events-rule-raw-sync" | ||
dependencies: | ||
- prod/namespaced/lambda-raw-sync.yaml | ||
parameters: | ||
RuleName: "{{ stack_group_config.namespace }}-lambda-raw-sync-trigger" | ||
RuleState: DISABLED | ||
LambdaArn: !stack_output_external "{{ stack_group_config.namespace }}-lambda-raw-sync::RawSyncFunctionArn" | ||
CronSchedule: cron(0 0 * * ? *) | ||
stack_tags: | ||
{{ stack_group_config.default_stack_tags }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
Description: Cloudwatch Events rule to trigger a Lambda on a cron schedule. | ||
|
||
Parameters: | ||
|
||
RuleName: | ||
Type: String | ||
Description: Name of this rule. | ||
|
||
RuleState: | ||
Type: String | ||
Description: > | ||
Whether to enable this rule upon deployment. Suggested values | ||
are "DISABLED" or "ENABLED". | ||
LambdaArn: | ||
Type: String | ||
Description: ARN of the Lambda to trigger. | ||
|
||
CronSchedule: | ||
Type: String | ||
Description: When to trigger the Lambda | ||
Default: "cron(0 0 * * ? *)" # At midnight UTC every day | ||
|
||
Resources: | ||
MyCloudWatchRule: | ||
Type: AWS::Events::Rule | ||
Properties: | ||
Name: !Ref RuleName | ||
State: !Ref RuleState | ||
ScheduleExpression: !Ref CronSchedule | ||
Targets: | ||
- Arn: !Ref LambdaArn | ||
Id: LambdaTarget | ||
|
||
LambdaInvokePermission: | ||
Type: AWS::Lambda::Permission | ||
Properties: | ||
Action: lambda:InvokeFunction | ||
FunctionName: !Ref LambdaArn | ||
Principal: events.amazonaws.com | ||
SourceArn: !GetAtt MyCloudWatchRule.Arn | ||
|
||
Outputs: | ||
RuleArn: | ||
Description: "ARN of the Cloudwatch events rule" | ||
Value: !GetAtt MyCloudWatchRule.Arn |