Cost Monitoring Construct is a CDK library that helps monitor costs for AWS cloud infrastructure resources, such as virtual machines, storage, and network traffic. It allows you to set budgets and alerts to ensure that you don't overspend on your cloud resources.
With the Cost Monitoring Construct, you can share the responsibility of cost management between developers and business holders. This is achieved through the creation of meaningful reports that enable the business team to make informed decisions. Additionally, the Construct generates boilerplate code that can be used to apply these decisions in practice, making it easier to stay on top of your budget.
To use Cost Monitoring Construct, all you need is to have the AWS CDK installed and set up. Once you have that, you can install the package from the repository of your choice.
For more information on using this Construct in TypeScript checkout the TypeScript documentation. You can also check the typescript example from sample folder on the GitHub repository.
Cloud services can get very expensive, very quickly, especially if you are not careful with your usage. Cost Monitoring Construct helps you to keep an eye on your cloud infrastructure costs so that you can stay within budget. By setting budgets and defining alert strategies, you can take proactive steps to reduce costs before they become a problem.
Cost Monitoring Construct uses AWS Tagging practice to track resources related to an specific application, creates proper alert with respect to the defined budget limit and provide overview dashbords. The tool is highly customizable and allows you to customize it to your budgeting strategy based on your specific needs.
Cost Monitoring Construct provides the following features:
- Cost dashboard: Displays your current costs and usage, broken down by application's name, region, and etc. Allows you to see how much you are spending on each application and where you might be able to reduce costs.
- Budgets: Allows you to set budgets for each applications. It will automatically set up alerts to notify you when your actual costs exceed your budgeted costs. It also continues to track the cost and sending alert if an application continues to cost drastically.
- Integration: Integrates with various tools and monitoring services, such as AWS Cost Explorer and Datadog.
Warning
ApplicationCostMonitoring uses AWS Tags to track resources' usages. You must activate your chosen tag key (cm:application
by default) under Cost Allocation Tags. The tag key will appear in the AWS console up to 24 hours after at least one AWS resource has been created with that tag.
Cost Monitoring Construct is useful for anyone who uses AWS and wants to keep their costs under control. It is particularly useful for:
- Startups and small businesses: Cost Monitoring Construct can help startups and small businesses to keep their costs under control during the early stages of growth.
- Large enterprises: Cost Monitoring Construct can help large enterprises to optimize their cloud usage and reduce costs across multiple teams and departments.
- Developers: Cost Monitoring Construct can help developers to track their usage and costs across multiple projects and services.
The Cost Monitoring Construct is not a magical tool that can solve all of your cloud cost problems. In spite of the fact that it can bring clarity and help you to identify areas where you can reduce costs, you must make the necessary decisions about your infrastructure on your own.
Cost Monitoring Construct has been developed using JSII technolgy to provide interfaces for different modern programming languages. Currently, it supports the following languages:
Note
Go will be supported soon but for now you can build it from the source.
If you have any questions or need help with Cost Monitoring Construct, you can reach out to our support team at [email protected].
import { Budget } from 'cost-monitoring-construct'
new Budget(scope: Construct, id: string, props: IBudgetProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
IBudgetProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: IBudgetProps
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
clone |
create a copy of the object with the provided changes. |
public toString(): string
Returns a string representation of this construct.
public clone(id: string, props: IOptionalBudgetProps): Budget
create a copy of the object with the provided changes.
- Type: string
a unique CDK Construct identifier.
- Type: IOptionalBudgetProps
you can choose to optionally pass all the initializer parameters of this class as the changes you wish to have on the cloned object.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
import { Budget } from 'cost-monitoring-construct'
Budget.isConstruct(x: any)
Checks if x
is a construct.
- Type: any
Any object.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
import { AccountCostMonitoring } from 'cost-monitoring-construct'
new AccountCostMonitoring(construct: Stack, props: IBudgetStrategyProps)
Name | Type | Description |
---|---|---|
construct |
aws-cdk-lib.Stack |
- use to define it's resources inside it. |
props |
IBudgetStrategyProps |
No description. |
- Type: aws-cdk-lib.Stack
use to define it's resources inside it.
- Type: IBudgetStrategyProps
Name | Description |
---|---|
createBudgets |
creates all the daily, monthly, quaryerly, and yearly budgets based on the implementation of the related methods. |
public createBudgets(): void
creates all the daily, monthly, quaryerly, and yearly budgets based on the implementation of the related methods.
Name | Type | Description |
---|---|---|
dailyLimit |
number |
calculates daily limit based on the provided monthly limit. |
monthlyLimit |
number |
returns montly limit. |
quarterlyLimit |
number |
calculates quarterly limit based on the provided monthly limit. |
yearlyLimit |
number |
calculates yearly limit based on the provided daily budget. |
defaultTopic |
aws-cdk-lib.aws_sns.Topic |
Return default SNS topic only if the defultTopic prop has been passed when instantiating. |
public readonly dailyLimit: number;
- Type: number
calculates daily limit based on the provided monthly limit.
public readonly monthlyLimit: number;
- Type: number
returns montly limit.
public readonly quarterlyLimit: number;
- Type: number
calculates quarterly limit based on the provided monthly limit.
public readonly yearlyLimit: number;
- Type: number
calculates yearly limit based on the provided daily budget.
public readonly defaultTopic: Topic;
- Type: aws-cdk-lib.aws_sns.Topic
Return default SNS topic only if the defultTopic prop has been passed when instantiating.
import { ApplicationCostMonitoring } from 'cost-monitoring-construct'
new ApplicationCostMonitoring(stack: Stack, props: ApplicationCostMonitoringProps)
Name | Type | Description |
---|---|---|
stack |
aws-cdk-lib.Stack |
- default stack to track its resources and it will be used to define Budget resources in it. |
props |
ApplicationCostMonitoringProps |
No description. |
- Type: aws-cdk-lib.Stack
default stack to track its resources and it will be used to define Budget resources in it.
Name | Description |
---|---|
createBudgets |
creates all the daily, monthly, quaryerly, and yearly budgets based on the implementation of the related methods. |
monitor |
Creates all the alarms, budgets and tags all resources with the application's name. |
public createBudgets(): void
creates all the daily, monthly, quaryerly, and yearly budgets based on the implementation of the related methods.
public monitor(): void
Creates all the alarms, budgets and tags all resources with the application's name.
Name | Type | Description |
---|---|---|
dailyLimit |
number |
calculates daily limit based on the provided monthly limit. |
monthlyLimit |
number |
returns montly limit. |
quarterlyLimit |
number |
calculates quarterly limit based on the provided monthly limit. |
yearlyLimit |
number |
calculates yearly limit based on the provided daily budget. |
defaultTopic |
aws-cdk-lib.aws_sns.Topic |
Return default SNS topic only if the defultTopic prop has been passed when instantiating. |
applicationName |
string |
No description. |
public readonly dailyLimit: number;
- Type: number
calculates daily limit based on the provided monthly limit.
public readonly monthlyLimit: number;
- Type: number
returns montly limit.
public readonly quarterlyLimit: number;
- Type: number
calculates quarterly limit based on the provided monthly limit.
public readonly yearlyLimit: number;
- Type: number
calculates yearly limit based on the provided daily budget.
public readonly defaultTopic: Topic;
- Type: aws-cdk-lib.aws_sns.Topic
Return default SNS topic only if the defultTopic prop has been passed when instantiating.
public readonly applicationName: string;
- Type: string
- Implements: IApplicationCostMonitoringProps
import { ApplicationCostMonitoringProps } from 'cost-monitoring-construct'
new ApplicationCostMonitoringProps(applicationName: string, monthlyLimitInDollars: number, subscribers: string[], otherStacksIncludedInBudget?: Stack[], defaultTopic?: string, costAllocationTag?: string)
Name | Type | Description |
---|---|---|
applicationName |
string |
- the name of application to label resources with it. |
monthlyLimitInDollars |
number |
- montly limit in US Dollors. |
subscribers |
string[] |
- list of email address that the CostMonitoring will use to send alerts to. |
otherStacksIncludedInBudget |
aws-cdk-lib.Stack[] |
- optional other stack to track their resources alog with the default stack. |
defaultTopic |
string |
- default SNS topic name. |
costAllocationTag |
string |
- Tag key used to track resources' expenditure. |
- Type: string
the name of application to label resources with it.
- Type: number
montly limit in US Dollors.
- Type: string[]
list of email address that the CostMonitoring will use to send alerts to.
- Type: aws-cdk-lib.Stack[]
optional other stack to track their resources alog with the default stack.
- Type: string
default SNS topic name.
Only if provided, the BudgetStratgy creates an SNS topic and send notifications to it.
- Type: string
Tag key used to track resources' expenditure.
Only if provided, it will be used to tag the application resources. Defaults to cm:application
Name | Type | Description |
---|---|---|
applicationName |
string |
- the name of application to label resources with it. |
monthlyLimitInDollars |
number |
- montly limit in US Dollors. |
subscribers |
string[] |
- list of email address that the CostMonitoring will use to send alerts to. |
costAllocationTag |
string |
- Tag key used to track resources' expenditure. |
defaultTopic |
string |
- default SNS topic name. |
otherStacksIncludedInBudget |
aws-cdk-lib.Stack[] |
- optional other stack to track their resources alog with the default stack. |
public readonly applicationName: string;
- Type: string
the name of application to label resources with it.
public readonly monthlyLimitInDollars: number;
- Type: number
montly limit in US Dollors.
public readonly subscribers: string[];
- Type: string[]
list of email address that the CostMonitoring will use to send alerts to.
public readonly costAllocationTag: string;
- Type: string
Tag key used to track resources' expenditure.
Only if provided, it will be used to tag the application resources. Defaults to cm:application
public readonly defaultTopic: string;
- Type: string
default SNS topic name.
Only if provided, the BudgetStratgy creates an SNS topic and send notifications to it.
public readonly otherStacksIncludedInBudget: Stack[];
- Type: aws-cdk-lib.Stack[]
optional other stack to track their resources alog with the default stack.
import { IBudgetStrategy } from 'cost-monitoring-construct'
new IBudgetStrategy(construct: Stack, props: IBudgetStrategyProps)
Name | Type | Description |
---|---|---|
construct |
aws-cdk-lib.Stack |
- use to define it's resources inside it. |
props |
IBudgetStrategyProps |
No description. |
- Type: aws-cdk-lib.Stack
use to define it's resources inside it.
- Type: IBudgetStrategyProps
Name | Description |
---|---|
createBudgets |
creates all the daily, monthly, quaryerly, and yearly budgets based on the implementation of the related methods. |
public createBudgets(): void
creates all the daily, monthly, quaryerly, and yearly budgets based on the implementation of the related methods.
Name | Type | Description |
---|---|---|
dailyLimit |
number |
calculates daily limit based on the provided monthly limit. |
monthlyLimit |
number |
returns montly limit. |
quarterlyLimit |
number |
calculates quarterly limit based on the provided monthly limit. |
yearlyLimit |
number |
calculates yearly limit based on the provided daily budget. |
defaultTopic |
aws-cdk-lib.aws_sns.Topic |
Return default SNS topic only if the defultTopic prop has been passed when instantiating. |
public readonly dailyLimit: number;
- Type: number
calculates daily limit based on the provided monthly limit.
public readonly monthlyLimit: number;
- Type: number
returns montly limit.
public readonly quarterlyLimit: number;
- Type: number
calculates quarterly limit based on the provided monthly limit.
public readonly yearlyLimit: number;
- Type: number
calculates yearly limit based on the provided daily budget.
public readonly defaultTopic: Topic;
- Type: aws-cdk-lib.aws_sns.Topic
Return default SNS topic only if the defultTopic prop has been passed when instantiating.
-
Extends: IBudgetStrategyProps
-
Implemented By: ApplicationCostMonitoringProps, IApplicationCostMonitoringProps
Name | Type | Description |
---|---|---|
monthlyLimitInDollars |
number |
No description. |
subscribers |
string[] |
No description. |
defaultTopic |
string |
No description. |
applicationName |
string |
No description. |
costAllocationTag |
string |
No description. |
otherStacksIncludedInBudget |
aws-cdk-lib.Stack[] |
No description. |
public readonly monthlyLimitInDollars: number;
- Type: number
public readonly subscribers: string[];
- Type: string[]
public readonly defaultTopic: string;
- Type: string
public readonly applicationName: string;
- Type: string
public readonly costAllocationTag: string;
- Type: string
public readonly otherStacksIncludedInBudget: Stack[];
- Type: aws-cdk-lib.Stack[]
- Implemented By: IBudgetAlertCondition
Name | Type | Description |
---|---|---|
period |
TimeUnit |
No description. |
threshold |
number |
No description. |
comparisonOperator |
ComparisonOperator |
No description. |
notificationType |
NotificationType |
No description. |
thresholdType |
ThresholdType |
No description. |
public readonly period: TimeUnit;
- Type: TimeUnit
public readonly threshold: number;
- Type: number
public readonly comparisonOperator: ComparisonOperator;
- Type: ComparisonOperator
public readonly notificationType: NotificationType;
- Type: NotificationType
public readonly thresholdType: ThresholdType;
- Type: ThresholdType
- Implemented By: IBudgetProps
Name | Type | Description |
---|---|---|
alertContdition |
IBudgetAlertCondition |
No description. |
limit |
number |
No description. |
subscribers |
aws-cdk-lib.aws_budgets.CfnBudget.SubscriberProperty[] |
No description. |
tags |
ITag[] |
No description. |
public readonly alertContdition: IBudgetAlertCondition;
- Type: IBudgetAlertCondition
public readonly limit: number;
- Type: number
public readonly subscribers: SubscriberProperty[];
- Type: aws-cdk-lib.aws_budgets.CfnBudget.SubscriberProperty[]
public readonly tags: ITag[];
- Type: ITag[]
- Implemented By: ApplicationCostMonitoringProps, IApplicationCostMonitoringProps, IBudgetStrategyProps
Name | Type | Description |
---|---|---|
monthlyLimitInDollars |
number |
No description. |
subscribers |
string[] |
No description. |
defaultTopic |
string |
No description. |
public readonly monthlyLimitInDollars: number;
- Type: number
public readonly subscribers: string[];
- Type: string[]
public readonly defaultTopic: string;
- Type: string
- Implemented By: IOptionalBudgetAlertCondition
Name | Type | Description |
---|---|---|
comparisonOperator |
ComparisonOperator |
No description. |
notificationType |
NotificationType |
No description. |
period |
TimeUnit |
No description. |
threshold |
number |
No description. |
thresholdType |
ThresholdType |
No description. |
public readonly comparisonOperator: ComparisonOperator;
- Type: ComparisonOperator
public readonly notificationType: NotificationType;
- Type: NotificationType
public readonly period: TimeUnit;
- Type: TimeUnit
public readonly threshold: number;
- Type: number
public readonly thresholdType: ThresholdType;
- Type: ThresholdType
- Implemented By: IOptionalBudgetProps
Name | Type | Description |
---|---|---|
alertContdition |
IOptionalBudgetAlertCondition |
No description. |
limit |
number |
No description. |
subscribers |
aws-cdk-lib.aws_budgets.CfnBudget.SubscriberProperty[] |
No description. |
tags |
ITag[] |
No description. |
public readonly alertContdition: IOptionalBudgetAlertCondition;
public readonly limit: number;
- Type: number
public readonly subscribers: SubscriberProperty[];
- Type: aws-cdk-lib.aws_budgets.CfnBudget.SubscriberProperty[]
public readonly tags: ITag[];
- Type: ITag[]
- Implemented By: ITag
Name | Type | Description |
---|---|---|
key |
string |
No description. |
value |
string | number |
No description. |
public readonly key: string;
- Type: string
public readonly value: string | number;
- Type: string | number
Name | Description |
---|---|
EQUAL_TO |
No description. |
GREATER_THAN |
No description. |
LESS_THAN |
No description. |
Name | Description |
---|---|
ACTUAL |
No description. |
FORECASTED |
No description. |
Name | Description |
---|---|
EMAIL |
No description. |
SNS |
No description. |
Name | Description |
---|---|
ABSOLUTE_VALUE |
No description. |
PERCENTAGE |
No description. |
Name | Description |
---|---|
DAILY |
No description. |
MONTHLY |
No description. |
QUARTERLY |
No description. |
ANNUALLY |
No description. |