AWS Lambda for Slack notification
Deploy a Slack webhook Lambda function.
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set aws-ts-lambda-slackcd pulumi-examples/aws-ts-lambda-slackA Pulumi example that:
- Creates an AWS Lambda function to post a message on Slack via a Webhook URL.
- Adds an AWS API Gateway so the Lambda can be invoked externally, e.g, via GitHub Webhooks.
- Uses a Pulumi ESC Environment to dynamically retrieve AWS OIDC Credentials and the Slack URL from AWS Secrets Manager.
Last update: September 2024
Prerequisites#
- Install Pulumi
- Configure AWS credentials
- Install Node.js
- A Pulumi Cloud account
- AWS OIDC configured in a Pulumi ESC Environment
- AWS Secrets Manager with a Slack Webhook URL secret
- A properly configured Slack Webhook URL
Deploying the example#
This Pulumi example is written as a template. It is meant to be copied via pulumi new.
-
Log in to your Pulumi Cloud if you haven’t already:
Terminal window pulumi login -
Create a new directory and change into it:
Terminal window mkdir my-slack-democd my-slack-demo -
Start your Pulumi project from this example:
Terminal window pulumi new https://github.com/pulumi/examples/aws-ts-lambda-slack -
Add your Pulumi ESC Environment and deploy:
Terminal window pulumi config env add YOUR_ESC_ENV --yes --non-interactivepulumi upSelect ‘yes’ to confirm the expected changes.
Cleaning up#
To clean up your infrastructure, run:
pulumi destroypulumi stack rmRelated
Tutorial
Build serverless APIs with Amazon API Gateway
ExampleTypeScript