Git Product home page Git Product logo

codepipeline-notification-to-slack's Introduction

AWS Lambda function to notify codepipeline events to slack

AWS Serverless Application: CodePipeline notification to slack

Design

  1. CodePipeline send event notification to Amazon SNS
  2. Invoking AWS Lambda functions via Amazon SNS
  3. Post to slack

Resources

  • CodePipeline
  • SNS Topic
  • KMS
  • lambda (python3.7)

Preparation

1. Create a SNS Topic

$ aws sns create-topic --name codepipeline

2. Create notification rule in CodePipeline application.

Select events that trigger notifications, and then choose above SNS Topic as targets.

3. Create a customer managed CMK.

https://docs.aws.amazon.com/en_us/kms/latest/developerguide/concepts.html#customer-cmk

4. Prepare parameters

Encrypt slack webhook url using above CMK.

$ aws kms encrypt --key-id alias/xxx --plaintext "hooks.slack.com/services/xxx"
{
    "CiphertextBlob": "xxx",
    "KeyId": "arn:aws:kms:ap-northeast-1:abc:key/xxx"
}
  • KMS_ENCRYPTED_HOOK_URL "CiphertextBlob"
  • KEY_ID "KeyId"

5. Deploy lambda function

$ S3_BUCKET=sam-artifacts \
SNS_TOPIC_ARN=arn:aws:sns:ap-northeast-1:abc:xxx \
KEY_ID=xxx \
SLACK_CHANNEL=#channel \
KMS_ENCRYPTED_HOOK_URL=xxx \
make deploy

Environment variables

  • S3_BUCKET s3 bucket for lambda source code
  • SNS_TOPIC_ARN created sns topic
  • KEY_ID created a customer managed CMK key id
  • SLACK_CHANNEL slack channel
  • KMS_ENCRYPTED_HOOK_URL encrypted slack webhook url using CMK

Related Projects

codepipeline-notification-to-slack's People

Contributors

yyoshiki41 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.