Skip to content

Latest commit

 

History

History
516 lines (283 loc) · 12.9 KB

API.md

File metadata and controls

516 lines (283 loc) · 12.9 KB

API Reference

Constructs

BillingAlarm

A construct to create an estimated monthly billing alarm associated with an SNS topic, and estimate billing alert notifications via email.

Initializers

import { BillingAlarm } from '@spacecomx/cdk-billing-alarm'

new BillingAlarm(scope: Construct, id: string, props: BillingAlarmProps)
scopeRequired

idRequired
  • Type: string

propsRequired

Properties

topicArnRequired
public readonly topicArn: CfnOutput;

BillingTopic

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.

Initializers

import { BillingTopic } from '@spacecomx/cdk-billing-alarm'

new BillingTopic(scope: Construct, id: string, props: BillingTopicProps)
scopeRequired

idRequired
  • Type: string

propsRequired

Properties

topicRequired
public readonly topic: ITopic;

Structs

AlarmOptions

Initializer

import { AlarmOptions } from '@spacecomx/cdk-billing-alarm'

const alarmOptions: AlarmOptions = { ... }
thresholdAmountRequired
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).


alarmDescriptionOptional
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.


alarmNameOptional
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).


numberOfHoursOptional
public readonly numberOfHours: number;
  • Type: number
  • Default: Duration.hours(6)

Evaluates the metric every few hours as EstimatedCharges metrics are updated every 6 hours.


BillingAlarmProps

Initializer

import { BillingAlarmProps } from '@spacecomx/cdk-billing-alarm'

const billingAlarmProps: BillingAlarmProps = { ... }
alarmConfigurationRequired
public readonly alarmConfiguration: AlarmOptions;

Alarm configuration options to configure the billing alarm e.g. (name, description etc.).


topicConfigurationRequired
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.


metricDimensionsOptional
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).


BillingTopicProps

Initializer

import { BillingTopicProps } from '@spacecomx/cdk-billing-alarm'

const billingTopicProps: BillingTopicProps = { ... }
displayNameOptional
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.


existingTopicArnOptional
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').


topicNameOptional
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).


emailAddressRequired
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. ['[email protected]'] or [''[email protected]', '[email protected]'].


jsonOptional
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.


MetricDimensionOptions

Initializer

import { MetricDimensionOptions } from '@spacecomx/cdk-billing-alarm'

const metricDimensionOptions: MetricDimensionOptions = { ... }
accountOptional
public readonly account: string;
  • Type: string
  • Default: Not configured.

Account which this metric comes from.


regionOptional
public readonly region: string;
  • Type: string
  • Default: Not configured.

Region which this metric comes from.


serviceOptional
public readonly service: string;
  • Type: string
  • Default: Not configured.

The AWS Service to associate the alarm with e.g (AWSService.AMAZON_API_GATEWAY).


SubscribeOptions

Initializer

import { SubscribeOptions } from '@spacecomx/cdk-billing-alarm'

const subscribeOptions: SubscribeOptions = { ... }
emailAddressRequired
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. ['[email protected]'] or [''[email protected]', '[email protected]'].


jsonOptional
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.


TopicOptions

Initializer

import { TopicOptions } from '@spacecomx/cdk-billing-alarm'

const topicOptions: TopicOptions = { ... }
displayNameOptional
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.


existingTopicArnOptional
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').


topicNameOptional
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).


Enums

AWSService

List of AWS Services to used to link a service to a billing alarm.

AMAZON_API_GATEWAY


AMAZON_CLOUD_FRONT


AMAZON_CLOUD_WATCH


AMAZON_DYNAMO_DB


AMAZON_RDS


AMAZON_ROUTE_53


AMAZON_S3


AMAZON_SES


AMAZON_SNS


AMAZON_WORK_MAIL


AWS_AMPLIFY


AWS_DATA_TRANSFER


AWS_LAMDA


AWS_KMS


AWS_MARKETPLACE


AWS_SECRETS_MANAGER


AWS_QUEUE_SERVICE