Skip to content

Instantly share code, notes, and snippets.

@klausbadelt
Last active October 8, 2018 06:27
Show Gist options
  • Save klausbadelt/6e2e4c6c2db4ac6cfcad54c21481f5d7 to your computer and use it in GitHub Desktop.
Save klausbadelt/6e2e4c6c2db4ac6cfcad54c21481f5d7 to your computer and use it in GitHub Desktop.
CloudFormation template excerpt - Lambda policy and CloudWatch event rule
WebPipelineNotifyPolicy:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName: !GetAtt WebPipelineNotifyFunction.Arn
Principal: events.amazonaws.com
SourceArn: !GetAtt WebPipelineNotifyRule.Arn
WebPipelineNotifyRule:
Type: AWS::Events::Rule
Properties:
Description: Triggers notification on pipeline state changes ie deploys
EventPattern:
detail-type:
- CodePipeline Pipeline Execution State Change
source:
- aws.codepipeline
State: ENABLED
Targets:
- Arn: !GetAtt WebPipelineNotifyFunction.Arn
Id: WebPipelineNotifyFunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment