A CDK construct to monitor estimated billing charges with alerts and notifications. It sets up an estimated monthly billing alarm associated with an email address endpoint. It then subscribes an email endpoint to an SNS Topic or an existing SNS Topic Arn.
The construct can be used to implement multiple customizable billing alarms for master/payer accounts e.g (AWS Organization). For customizable multi-account billing alarm requirements, see @spacecomx/cdk-organization-billing-alarm
Some features built-in:
- consolidated charge estimates of all AWS services in your AWS account.
- associate the billing alarm with an existing SNS topic Arn in your AWS account.
- consolidated charges for a specific AWS service used by your AWS account e.g. Amazon DynamoDB.
- consolidated charges for all linked accounts within the master/payer account e.g. AWS Organization.
- consolidated charges for linked account within a master/payer account.
- consolidated charges for linked account and AWS service within the master/payer account.
⚠️ Before you can create a billing alarm, you must enable billing alerts in your account, or the master/payer account if you are using consolidated billing. For more information, see Enabling Billing Alerts.
TypeScript/JavaScript:
npm i @spacecomx/cdk-billing-alarm
or:
yarn add @spacecomx/cdk-billing-alarm
Python:
pip install spacecomx.cdk-billing-alarm
This type of billing alarm configuration will provide estimated charges for every AWS Service that you use, in addition to the estimated overall total of your AWS charges within your AWS account. For more advanced examples and custom implementations, see documentation.
🔸 The
emailAddress
is an endpoint that subscribes to a SNS topic. ThethresholdAmount
is the amount in USD, that will trigger the alarm when AWS charges exceed the threshold.
import { Stack, StackProps } from '@aws-cdk/core';
import { BillingAlarm, BillingAlarmProps } from '@spacecomx/cdk-billing-alarm';
export class BillingAlarmStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps) {
super(scope, id, props);
const options: BillingAlarmProps = {
topicConfiguration: {
emailAddress: ['john@example.org'], // required
},
alarmConfiguration: {
alarmDescription: 'Consolidated Billing Alarm - All AWS Services',
thresholdAmount: 150, // required
},
};
new BillingAlarm(this, 'BillingAlarm', options);
}
}
For more advanced examples and custom implementations, see documentation
For more detail, see API documentation
Contributions of all kinds are welcome! Check out our contributor's guide and our code of conduct
- @spacecomx/cdk-organization-billing-alarm - used for multi-account AWS Organization billing alarm requirements.
- aws-cdk-billing-alarm
@spacecomx/cdk-billing-alarm is distributed under the MIT license.