Skip to main content

aws-cdk-billing-alarm

Project description

aws-cdk-billing-alarm

Build status NPM version PyPI version Mentioned in Awesome CDK

A CDK construct that sets up email notification for when you exceed a given AWS estimated charges amount.

Create this construct in any stack you find appropriate with only a few lines. This construct is an implementation of the manual setup described on AWS Estimated Charges Monitoring.

Get Started

Pre-Requisites

IMPORTANT! Only complete Step 1: Enable Billing Alerts of the following documentation link. This construct will take care of creating the rest of the resources for you.

You must first enable billing alerts from the AWS Console as per documentation.

Billing alerts will allow your AWS account to start collecting billing metrics (EstimatedCharges) on a periodic 6-hour basis.

Installation

Node documentation

npm install --save aws-cdk-billing-alarm

Python documentation

pip install aws-cdk-billing-alarm

Usage

# Example automatically generated from non-compiling source. May contain errors.
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { BillingAlarm } from 'aws-cdk-billing-alarm';

class CdkStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    // Create an alarm that emails `admin@example.com`
    // if estimated charges exceed 50 USD
    new BillingAlarm(this, 'AWSAccountBillingAlarm', {
      monthlyThreshold: 50,
      emails: ['admin@example.com'],
    });
  }
}

Post-Deployment

Confirm the subscription to the newly created topic for the emails you specified as endpoints in BillingAlarmProps. You can do so by clicking on the SubscribeURL of the JSON email you received.

Note: If you did not receive the email, you can fire a Request confirmation for the subscription from the AWS SNS Console.

Limitations

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-cdk-billing-alarm-1.1.0.tar.gz (111.9 kB view hashes)

Uploaded Source

Built Distribution

aws_cdk_billing_alarm-1.1.0-py3-none-any.whl (111.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page