A construct to create an estimated monthly billing alarm associated with an SNS topic, and estimate billing alert notifications via email.
import { BillingAlarm } from '@spacecomx/cdk-billing-alarm'
new BillingAlarm(scope: Construct, id: string, props: BillingAlarmProps)
- Type:
@aws-cdk/core.Construct
- Type:
string
public readonly topicArn: CfnOutput;
- Type:
@aws-cdk/core.CfnOutput
A construct to create a new SNS topic or use an existing SNS topic Arn.
It then subscribes the configured email address to the SNS topic or the existing SNS topic Arn.
import { BillingTopic } from '@spacecomx/cdk-billing-alarm'
new BillingTopic(scope: Construct, id: string, props: BillingTopicProps)
- Type:
@aws-cdk/core.Construct
- Type:
string
public readonly topic: ITopic;
- Type:
@aws-cdk/aws-sns.ITopic
import { AlarmOptions } from '@spacecomx/cdk-billing-alarm'
const alarmOptions: AlarmOptions = { ... }
public readonly thresholdAmount: number;
- Type:
number
Enter the monthly threshold amount in USD that must be exceeded to trigger the alarm e.g. (thresholdAmount: 150).
public readonly alarmDescription: string;
- Type:
string
- Default: Not configured
Description for the alarm.
A developer-defined string that can be used to identify this alarm.
public readonly alarmName: string;
- Type:
string
- Default: Generated name
Name of the alarm.
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the alarm name (recommended).
public readonly numberOfHours: number;
- Type:
number
- Default: Duration.hours(6)
Evaluates the metric every few hours as EstimatedCharges
metrics are updated every 6 hours.
import { BillingAlarmProps } from '@spacecomx/cdk-billing-alarm'
const billingAlarmProps: BillingAlarmProps = { ... }
public readonly alarmConfiguration: AlarmOptions;
Alarm configuration options to configure the billing alarm e.g. (name, description etc.).
public readonly topicConfiguration: BillingTopicProps;
Topic configuration options to configure the SNS topic and email address's that will be used to subscribe to the topic.
public readonly metricDimensions: MetricDimensionOptions;
Metric dimension options to configure advanced alarm metrics e.g. (link the alarm to a specific account, region or AWS service).
import { BillingTopicProps } from '@spacecomx/cdk-billing-alarm'
const billingTopicProps: BillingTopicProps = { ... }
public readonly displayName: string;
- Type:
string
- Default: Not configured
The display name of the topic.
A developer-defined string that can be used to identify this SNS topic.
public readonly existingTopicArn: string;
- Type:
string
- Default: Not configured
Use an existing SNS topic ARN e.g. ('arn:aws:sns:us-east-2:444455556666:MyTopic').
public readonly topicName: string;
- Type:
string
- Default: Generated name
The name of the topic.
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the topic name (recommended).
public readonly emailAddress: string[];
- Type:
string
[]
The email address that will be used to subcribe to the SNS topic for billing alert notifications e.g. ['hello@example.org'] or [''hello@example.org', 'admin@example.org'].
public readonly json: boolean;
- Type:
boolean
- Default: false (Message text)
Indicates if the full notification JSON should be sent to the email address or just the message text.
import { MetricDimensionOptions } from '@spacecomx/cdk-billing-alarm'
const metricDimensionOptions: MetricDimensionOptions = { ... }
public readonly account: string;
- Type:
string
- Default: Not configured.
Account which this metric comes from.
public readonly region: string;
- Type:
string
- Default: Not configured.
Region which this metric comes from.
public readonly service: string;
- Type:
string
- Default: Not configured.
The AWS Service to associate the alarm with e.g (AWSService.AMAZON_API_GATEWAY).
import { SubscribeOptions } from '@spacecomx/cdk-billing-alarm'
const subscribeOptions: SubscribeOptions = { ... }
public readonly emailAddress: string[];
- Type:
string
[]
The email address that will be used to subcribe to the SNS topic for billing alert notifications e.g. ['hello@example.org'] or [''hello@example.org', 'admin@example.org'].
public readonly json: boolean;
- Type:
boolean
- Default: false (Message text)
Indicates if the full notification JSON should be sent to the email address or just the message text.
import { TopicOptions } from '@spacecomx/cdk-billing-alarm'
const topicOptions: TopicOptions = { ... }
public readonly displayName: string;
- Type:
string
- Default: Not configured
The display name of the topic.
A developer-defined string that can be used to identify this SNS topic.
public readonly existingTopicArn: string;
- Type:
string
- Default: Not configured
Use an existing SNS topic ARN e.g. ('arn:aws:sns:us-east-2:444455556666:MyTopic').
public readonly topicName: string;
- Type:
string
- Default: Generated name
The name of the topic.
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the topic name (recommended).
List of AWS Services to used to link a service to a billing alarm.