Skip to main content

Daily spend to slack

A construct that deploys a CloudWatch cronjob that will trigger a Lambda that will fetch the yesterday usage of AWS and send it to a SNS as a spoofed ECR CloudWatch event that can be parsed by AWS Chatbot and send to Slack.

Yes, that was a mouthful. But the general idea is that to create a FinOps/Cost optimization culture in your team, your team also needs to know what they are spending. That is why I created this. This construct will deliver the yesterday usage to your slack channel of choice. This can also be a private channel.

Example of Daily Spend Bot

Installation

Manual steps

Your AWS account must be connected with your Slack channel. This can't be done by IaC but involves manual steps.

  1. Follow the steps of Step 1 in the category "Setting up AWS Chatbot with Slack"

CDK steps

# Example automatically generated from non-compiling source. May contain errors.
'use strict';
import { App, Stack } from 'aws-cdk-lib';
import { Schedule } from 'aws-cdk-lib/aws-events';
import { DailySpendToSlack } from './index';

const app = new App();
const stack = new Stack(app, 'DailySpendToSlack');

new DailySpendToSlack(stack, 'DailySpendToSlack', {
  schedule: Schedule.cron({ minute: '0', hour: '9' }),
  slackWorkspaceId: '',
  slackChannelId: '',
  slackChannelName: '',
  accountName: 'stroobants.dev',
});

Parameters

  • schedule: Schedule - The schedule it should run on, for example Schedule.cron({ minute: '0', hour: '9' }) means everyday at 09:00 UTC
  • slackWorkspaceId: string - The ID that AWS generates for (see picture below)
  • slackChannelId: string - The ID of the Slack Channel (Open slack, right-click on the channel you want the bot in, Copy link) -> https://cloudar.slack.com/archives/{slackChannelId})
  • slackChannelName: string - The name of the Slack channel (this will be used to generate the Configuration name)
  • accountName: string - You can give the bot a recognizable name, lowercase, max 30 and only .- allowed (could be more but that is what I tested)

your workspace

License

Mozilla Public License 2.0

Metadata

Release files for cdk-daily-spend-to-slack 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdk-daily-spend-to-slack 0.0.3
File Size Uploaded Provenance Actions
cdk-daily-spend-to-slack-0.0.3.tar.gz 33.4 kB Without provenance Details for cdk-daily-spend-to-slack-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cdk-daily-spend-to-slack 0.0.3
File Interpreter ABI Platform Actions
cdk_daily_spend_to_slack-0.0.3-py3-none-any.whl Python 3 none any Details for cdk_daily_spend_to_slack-0.0.3-py3-none-any.whl

Total release size: 65.7 kB

Release files / cdk-daily-spend-to-slack-0.0.3.tar.gz

Download URL cdk-daily-spend-to-slack-0.0.3.tar.gz
Size 33.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c1beae02d0871e00b5e3a8234759d42915d9c9ed4c1aa92ccff27fdd82f2a6fe
BLAKE2b-256 checksum
How to use checksums
fdfdeb54a95316302cc79bd940d8327e98d6e5b4a632b5fe7003a2fb5cf44337
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3

Release files / cdk_daily_spend_to_slack-0.0.3-py3-none-any.whl

Download URL cdk_daily_spend_to_slack-0.0.3-py3-none-any.whl
Size 32.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71048c193743ded4715829afc8d9c7d8a2e143dcb55554b02b39a2cc96201a67
BLAKE2b-256 checksum
How to use checksums
6c012bf8bda5827c19bd96404e8cbcfe7d59535e54694013a3a257a86de1c79b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3

Security for cdk-daily-spend-to-slack 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page