Last active
October 8, 2018 06:27
-
-
Save klausbadelt/75e2178407dca1483bc9a917b1ba98fd to your computer and use it in GitHub Desktop.
CloudFormation template excerpt - lambda function
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
WebPipelineNotifyFunction: | |
Type: AWS::Lambda::Function | |
Properties: | |
Code: | |
ZipFile: | | |
var SNS = require('aws-sdk/clients/sns') | |
var sns = new SNS() | |
exports.handler = async (event) => { | |
console.log(JSON.stringify(event)) | |
const params = { | |
Message: `Deploy of ${process.env.BRANCH} ${event.detail.state}`, | |
TopicArn: process.env.TOPIC_ARN, | |
Subject: `Deploy ${event.detail.state}` | |
} | |
console.log(JSON.stringify(params)) | |
return await sns.publish(params).promise() | |
} | |
Description: Notifies of deploys with SMS and email | |
Environment: | |
Variables: | |
TOPIC_ARN: !Ref DevNotifyTopic | |
BRANCH: !Ref DeployBranch | |
Handler: index.handler | |
Role: !GetAtt LambdaServiceRole.Arn | |
Runtime: nodejs8.10 | |
Timeout: 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment