1. Docs
  2. @pulumi/awsx
  3. classic
  4. cloudwatch

Module classic/cloudwatch

Pulumi Cloudwatch Components

Amazon CloudWatch monitors your Amazon Web Services (AWS) resources and the applications you run on AWS in real time. You can use Pulumi’s CloudWatch components to collect and track metrics, which are variables you can measure for your resources and applications.

The CloudWatch home page automatically displays metrics about every AWS service you use. You can additionally create custom dashboards to display metrics about your custom applications, and display custom collections of metrics that you choose.

You can create alarms which watch metrics and send notifications or automatically make changes to the resources you are monitoring when a threshold is breached. For example, you can monitor the CPU usage and disk reads and writes of your Amazon EC2 instances and then use this data to determine whether you should launch additional instances to handle increased load. You can also use this data to stop under-used instances to save money.

With CloudWatch, you gain system-wide visibility into resource utilization, application performance, and operational health.

Metrics

Metric resources are the fundamental concept in CloudWatch. A metric represents a time-ordered set of data points that are published to CloudWatch. Think of a metric as a variable to monitor, and the data points as representing the values of that variable over time. For example, the CPU usage of a particular EC2 instance is one metric provided by Amazon EC2. The data points themselves can come from any application or business activity from which you collect data.

AWS services send metrics to CloudWatch, and you can send your own custom metrics to CloudWatch. You can add the data points in any order, and at any rate you choose. You can retrieve statistics about those data points as an ordered set of time-series data.

Metrics exist only in the region in which they are created. Metrics cannot be deleted, but they automatically expire after 15 months if no new data is published to them. Data points older than 15 months expire on a rolling basis; as new data points come in, data older than 15 months is dropped.

Metrics are uniquely defined by a name, a namespace, and zero or more dimensions. Each data point in a metric has a time stamp, and (optionally) a unit of measure. You can retrieve statistics from CloudWatch for any metric.

see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Metric for more details.

Predefined metrics

Most commonly, applications will want to work with existing metrics produced by AWS services. These metrics are exposed through the corresponding for awsx module in a submodule called metrics. For example:

const func = new aws.lambda.CallbackFunction(...);
const funcMetric = awsx.lambda.metrics.duration({ function: func, unit: "Seconds" });

In this example, this will return the metric giving information about how long each invocation of this function takes, in seconds. Metrics sometimes relate to an entire service, or (like in the above example) will be tied to some resource or subset of resources. When obtaining a metric, it’s possible to specify the following:

  1. The period of the metric. This specifies over what time period the data will be collected.
  2. The statistic to be collected. For example, asking for the Average, or Maximum value of that metric over the requested period.
  3. The unit the metric should be collected in. For example, for bandwidth, Megabytes/Second.

Not all of these can be controlled for a particular metric, and not all values are legal for any given metric. For example, some metrics may not support collecting the Maximum statistic. See the docs for each individual Metric for more information on what is specifiable or not.

Alarms

You can create a CloudWatch alarm that watches a single CloudWatch metric. The alarm performs one or more actions based on the value of the metric or expression relative to a threshold over a number of time periods. The action can be an Amazon EC2 action, an Amazon EC2 Auto Scaling action, or a notification sent to an Amazon SNS topic.

You can also add alarms to CloudWatch dashboards and monitor them visually. When an alarm is on a dashboard, it turns red when it is in the ALARM state, making it easier for you to monitor its status proactively.

Alarms invoke actions for sustained state changes only. CloudWatch alarms do not invoke actions simply because they are in a particular state, the state must have changed and been maintained for a specified number of periods.

After an alarm invokes an action due to a change in state, its subsequent behavior depends on the type of action that you have associated with the alarm. For Amazon EC2 Auto Scaling actions, the alarm continues to invoke the action for every period that the alarm remains in the new state. For Amazon SNS notifications, no additional actions are invoked.

When creating an alarm, the following can be specified:

  1. threshold. The value to compare the metric value against.
  2. comparisonOperator. The type of comparison that should be made between the metric value and the threshold value. The default is "GreaterThanOrEqualToThreshold".
  3. evaluationPeriods. The number of periods over which data is compared to the specified threshold.

To create an alarm from a metric:

const func = new aws.lambda.CallbackFunction(...);
const funcMetric = awsx.lambda.metrics.duration({ function: func, period: 300, unit: "Seconds" });
const alarm = funcMetric.createAlarm("alarm", {
    threshold: 120,
    evaluationPeriods: 2,
});

To report the alarm to an SNS Topic:

const alarm = funcMetric.createAlarm("alarm", {
    threshold: 120,
    evaluationPeriods: 2,
    alarmActions: [someTopic],
});

See Autoscaling Scaling Policies for more details on easily connecting metric changes to autoscaling group changes.

Dashboards

Amazon CloudWatch dashboards are customizable home pages in the CloudWatch console that you can use to monitor your resources in a single view, even those resources that are spread across different Regions. You can use CloudWatch dashboards to create customized views of the metrics and alarms for your AWS resources.

With dashboards, you can create the following:

  1. A single view for selected metrics and alarms to help you assess the health of your resources and applications across one or more regions. You can select the color used for each metric on each graph, so that you can easily track the same metric across multiple graphs.
  2. An operational playbook that provides guidance for team members during operational events about how to respond to specific incidents.
  3. A common view of critical resource and application measurements that can be shared by team members for faster communication flow during operational events.

Widgets

Dashboards are created from Widgets that are then automatically placed on a 24 unit wide, infinitely tall grid, based on flow constraints. When creating widgets, a desired Width-x-Height cab be supplied (otherwise a default size of 6x6 is used). Widgets can then be related to other widgets by either placing them in a Column or in a Row. Widgets placed in a column can flow veritically as far as necessary. Widgets placed in a row will wrap automatically after 24 grid spaces.

Text widgets

You can place a simple piece of text on the dashboard using a Text Widget. These can contain markdown and will be rendered by the dashboard in the requested location and size.

Space widgets

The Space Widget acts as a simple mechanism to place a gap (with a desired Width-x-Height) in between other widgets.

Metric widgets

The most common widgets that will be added to a Dashboard are ‘metric’ widgets. i.e. widgets that display the latest reported values of some metric. These metrics can be shown on the dashboard as either a ine-graph, stacked-graph, or as a single-number. Creating these can be done like so:

// Get the metric for the lambda that processing our topic requests.
const funcMetric = awsx.lambda.metrics.duration({ function: func });

// Also create a dashboard to track this.
const dashboard = new awsx.cloudwatch.Dashboard("TopicData", {
    widgets: [
        new awsx.cloudwatch.SingleNumberMetricWidget({
            title: "Requests in the last minute",
            width: 10,
            metrics: awsx.lambda.metrics.invocations({
                function: func,
                unit: "Sum",
                period: 60,
            }),
        }),
        new awsx.cloudwatch.LineGraphMetricWidget({
            title: "Lambda duration",
            width: 14,

            // Log our different p90/p95/p99 latencies
            metrics: [
                funcMetric.with({ extendedStatistic: 90, label: "Duration p90" }),
                funcMetric.with({ extendedStatistic: 95, label: "Duration p95" }),
                funcMetric.with({ extendedStatistic: 98, label: "Duration p99" }),
            ],
        }),
    ],
});

Graph widgets can also have a line on them showing the breaching threshold for a specific alarm using annotations. This can be done like so:

// Create an alarm if this lambda takes more than 1000ms to complete in a period of 10 minutes over
// at least five periods in a row.
const funcAlarm1 = funcMetric.with({ unit: "Milliseconds", period: 600 })
                             .createAlarm("SlowUrlProcessing", { threshold: 1000, evaluationPeriods: 5 });

// Also create a dashboard to track this.
const dashboard = new awsx.cloudwatch.Dashboard("TopicData", {
    widgets: [
        ...,
        new awsx.cloudwatch.LineGraphMetricWidget({
            title: "Lambda duration",
            width: 14,

            // Place a line on the graph to indicate where our alarm will be triggered.
            annotations: new awsx.cloudwatch.HorizontalAnnotation(funcAlarm1),

            // Log our different p90/p95/p99 latencies
            metrics: [
                funcMetric.with({ extendedStatistic: 90, label: "Duration p90" }),
                funcMetric.with({ extendedStatistic: 95, label: "Duration p95" }),
                funcMetric.with({ extendedStatistic: 98, label: "Duration p99" }),
            ],
        }),
    ],
});

More complex widget customization is possible. See the invidual types and arguments in the Cloudwatch API for more details.

APIs

APIs

class AlarmAnnotation

 implements WidgetAnnotation

Adds an alarm annotation to a [MetricWidget], allowing a metric alarm to be displayed in a Dashboard.

constructor

new AlarmAnnotation(alarmArn: pulumi.Input<string>)

method addWidgetJson

public addWidgetJson(annotations: MetricWidgetAnnotationsJson): void

For internal use only.

interface AlarmArgs

interface AlarmArgs

property actionsEnabled

actionsEnabled?: pulumi.Input<boolean>;

Indicates whether or not actions should be executed during any changes to the alarm’s state. Defaults to true.

property alarmActions

alarmActions?: pulumi.Input<pulumi.Input<string | Topic>[]>;

The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).

property alarmDescription

alarmDescription?: pulumi.Input<string>;

The description for the alarm.

property comparisonOperator

comparisonOperator?: pulumi.Input<AlarmComparisonOperator>;

The arithmetic operation to use when comparing the specified Statistic and Threshold. The specified Statistic value is used as the first operand. Either of the following is supported: GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold.

Defaults to [GreaterThanOrEqualToThreshold] if unspecified.

property datapointsToAlarm

datapointsToAlarm?: pulumi.Input<number>;

The number of datapoints that must be breaching to trigger the alarm.

property evaluateLowSampleCountPercentiles

evaluateLowSampleCountPercentiles?: pulumi.Input<"ignore" | "evaluate">;

Used only for alarms based on percentiles. If you specify ignore, the alarm state will not change during periods with too few data points to be statistically significant. If you specify evaluate or omit this parameter, the alarm will always be evaluated and possibly change state no matter how many data points are available. The following values are supported: ignore, and evaluate.

property evaluationPeriods

evaluationPeriods: pulumi.Input<number>;

The number of periods over which data is compared to the specified threshold.

property extendedStatistic

extendedStatistic?: pulumi.Input<string>;

The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.

property insufficientDataActions

insufficientDataActions?: pulumi.Input<pulumi.Input<string | Topic>[]>;

The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN).

property metricQueries

metricQueries?: pulumi.Input<pulumi.Input<{
    expression?: pulumi.Input<string>;
    id: pulumi.Input<string>;
    label?: pulumi.Input<string>;
    metric?: pulumi.Input<{
        dimensions?: pulumi.Input<{[key: string]: string}>;
        metricName: pulumi.Input<string>;
        namespace?: pulumi.Input<string>;
        period: pulumi.Input<number>;
        stat: pulumi.Input<string>;
        unit?: pulumi.Input<string>;
    }>;
    returnData?: pulumi.Input<boolean>;
}>[]>;

Enables you to create an alarm based on a metric math expression. You may specify at most 20.

property name

name?: pulumi.Input<string>;

The descriptive name for the alarm. This name must be unique within the user’s AWS account

property okActions

okActions?: pulumi.Input<pulumi.Input<string | Topic>[]>;

The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).

property threshold

threshold: pulumi.Input<number>;

The value against which the specified statistic is compared.

property treatMissingData

treatMissingData?: pulumi.Input<"missing" | "ignore" | "breaching" | "notBreaching">;

Sets how this alarm is to handle missing data points. The following values are supported: missing, ignore, breaching and notBreaching. Defaults to missing.

type AlarmComparisonOperator

type AlarmComparisonOperator = "GreaterThanOrEqualToThreshold" | "GreaterThanThreshold" | "LessThanThreshold" | "LessThanOrEqualToThreshold";

class AlarmWidget

 implements Widget

Simple widget that displays an array of cloudwatch alarm status in the dashboard grid.

constructor

new AlarmWidget(args: AlarmWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method computeProperties

protected computeProperties(region: pulumi.Output<aws.Region>)

method computeType

protected computeType()

method height

public height(): number

method width

public width(): number

interface AlarmWidgetArgs

interface AlarmWidgetArgs extends SimpleWidgetArgs

property alarms

alarms: pulumi.Input<string>[];

An array of alarm ARNs to include in the widget. The array can have 1-100 ARNs.

property height

height?: undefined | number;

The height of the widget in grid units. The default is 6.

Valid Values: 1–1000

property sortBy

sortBy?: pulumi.Input<"default" | "stateUpdatedTimestamp" | "timestamp" | undefined>;

Specifies how to sort the alarms in the widget.

Choose default to sort them in alphabetical order by alarm name.

Choose stateUpdatedTimestamp to sort them first by alarm state, with alarms in ALARM state first, INSUFFICIENT_DATA alarms next, and OK alarms last. Within each group, the alarms are sorted by when they last changed state, with more recent state changes listed first.

Choose timestamp to sort them by the time when the alarms most recently changed state, no matter the current alarm state. The alarm that changed state most recently is listed first.

If you omit this field, the alarms are sorted in alphabetical order.

property states

states?: pulumi.Input<"ALARM" | "INSUFFICIENT_DATA" | "OK"[] | undefined>;

Use this field to filter the list of alarms displayed in the widget to only those alarms currently in the specified states. You can specify one or more alarm states in the value for this field. The alarm states that you can specify are ALARM, INSUFFICIENT_DATA, and OK.

If you omit this field or specify an empty array, all the alarms specified in alarms are displayed.

property title

title?: pulumi.Input<string>;

The title to be displayed for the alarm widget.

property width

width?: undefined | number;

The width of the widget in grid units (in a 24-column grid). The default is 6.

Valid Values: 1–24

interface AlarmWidgetJson

interface AlarmWidgetJson extends WidgetJson

property height

height: pulumi.Input<number>;

property properties

properties: pulumi.Input<AlarmWidgetPropertiesJson>;

property type

type: pulumi.Input<"alarm">;

property width

width: pulumi.Input<number>;

property x

x: pulumi.Input<number>;

property y

y: pulumi.Input<number>;

interface AlarmWidgetPropertiesJson

interface AlarmWidgetPropertiesJson

property alarms

alarms: pulumi.Input<pulumi.Input<string>[]>;

property sortBy

sortBy: pulumi.Input<"default" | "stateUpdatedTimestamp" | "timestamp" | undefined>;

property states

states: pulumi.Input<"ALARM" | "INSUFFICIENT_DATA" | "OK"[] | undefined>;

property title

title: pulumi.Input<string | undefined>;

interface BaseHorizontalAnnotationJson

interface BaseHorizontalAnnotationJson

property label

label: pulumi.Input<string | undefined>;

property value

value: pulumi.Input<number>;

class ColumnWidget

 implements Widget

Represents a vertical sequence of [Widget]s in the [Dashboard]. There is no limit on how long this sequence will be.

The final width of this widget will be the width of the largest item in the column. The final height of this widget will be the sum of all the heights of all the widgets in the column.

constructor

new ColumnWidget(widgets: Widget[])

method addWidget

public addWidget(widget: Widget): void

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method getWidgetRelativePositions

protected getWidgetRelativePositions(): Map<Widget, WidgetRelativePosition>

method height

public height(): number

method width

public width(): number

property widgets

protected widgets: Widget[] = [];

class Dashboard

class Dashboard extends Dashboard

[Dashboard]s are represented by a grid of columns 24 wide, with an unlimited number of rows.

Each [Widget] in the [Dashboard] have a specific width/height in terms of grid units.

A [Dashboard] can include up to 100 widgets. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html#CloudWatch-Dashboard-Properties-Rendering-Object-Format for more details.

constructor

new Dashboard(name: string, args: DashboardArgs, opts: CustomResourceOptions)

Constructs a [DashboardGrid] out of [Widget]s. If any of these Widgets are [RowWidget]s. then these will be treated as a sequence of rows to add to the grid. Otherwise, this will be treated as a single row to add to the grid.

method get

static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DashboardState, opts?: pulumi.CustomResourceOptions): Dashboard

Get an existing Dashboard resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): obj is Dashboard

Returns true if the given object is an instance of Dashboard. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property dashboardArn

dashboardArn: pulumi.Output<string>;

The Amazon Resource Name (ARN) of the dashboard.

property dashboardBody

dashboardBody: pulumi.Output<string>;

The detailed information about the dashboard, including what widgets are included and their location on the dashboard. You can read more about the body structure in the documentation.

property dashboardName

dashboardName: pulumi.Output<string>;

The name of the dashboard.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property url

public url: pulumi.Output<string>;

The url this [Dashboard] is published at.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

interface DashboardArgs

interface DashboardArgs

property end

end?: pulumi.Input<string>;

The end of the time range to use for each widget on the dashboard when the dashboard loads. If you specify a value for end, you must also specify a value for start. For each of these values, specify an absolute time in the ISO 8601 format. For example, 2018-12-17T06:00:00.000Z.

property name

name?: pulumi.Input<string>;

The name of the dashboard.

property periodOverride

periodOverride?: pulumi.Input<"auto" | "inherit">;

Use this field to specify the period for the graphs when the dashboard loads. Specifying auto causes the period of all graphs on the dashboard to automatically adapt to the time range of the dashboard. Specifying inherit ensures that the period set for each graph is always obeyed.

property region

region?: pulumi.Input<aws.Region>;

The region that widgets can say they’re associated with. If not provided, the region will be inferred by whatever provider the [Dashboard] ends up using.

property start

start?: pulumi.Input<string>;

The start of the time range to use for each widget on the dashboard.

You can specify start without specifying end to specify a relative time range that ends with the current time. In this case, the value of start must begin with -P, and you can use M, H, D, W and M as abbreviations for minutes, hours, days, weeks and months. For example, -PT8H shows the last 8 hours and -P3M shows the last three months.

You can also use start along with an end field, to specify an absolute time range. When specifying an absolute time range, use the ISO 8601 format. For example, 2018-12-17T06:00:00.000Z.

If you omit start, the dashboard shows the default time range when it loads.

property widgets

widgets?: Widget[];

Widgets to initially add to the [DashboardDescription]. If any of these are [RowWidgets] this will be treated as a sequence of rows. If not, then this will be treated as a sequence of widgets to make a single row out of.

type ExpressionMetricJson

type ExpressionMetricJson = [, {
    expression: pulumi.Input<string>;
    id: pulumi.Input<string | undefined>;
    label: pulumi.Input<string | undefined>;
}];

class ExpressionWidgetMetric

 implements WidgetMetric

Used to pass math or search expressions to a [MetricWidget].

See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html and https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-search-expressions.html for more details.

constructor

new ExpressionWidgetMetric(expression: pulumi.Input<string>, label?: pulumi.Input<string>, id?: pulumi.Input<string>)
  • expression The math expression or search expression.
  • label The label to display in the graph to represent this time series.
  • id The id of this time series. This id can be used as part of a math expression.

method addWidgetJson

addWidgetJson(metrics: wjson.MetricJson[]): void

For internal use only.

class FlowWidget

 implements Widget

A sequence of widgets flowing either horizontally or vertically. Widgets flowing horizontally must wrap after 24 grid columns. There is no effective vertical limit on widgets flowing vertically.

constructor

new FlowWidget(widgets: Widget[])

method addWidget

public addWidget(widget: Widget): void

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method getWidgetRelativePositions

protected getWidgetRelativePositions(): Map<Widget, WidgetRelativePosition>

Determines the relative positions of all the child widgets in this [FlowWidget]. ‘Relative Position’ tells us where the widget should be placed relative to the upper-left point of this FlowWidget.

method height

public height(): number

method width

public width(): number

property widgets

protected widgets: Widget[] = [];

class GraphMetricWidget

 implements Widget

Base type for widets that display metrics as a graph (either a line or stacked graph).

See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph_metrics.html for more details.

constructor

new GraphMetricWidget(graphArgs: GraphMetricWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method computeProperties

protected computeProperties(region: pulumi.Output<aws.Region>)

method computeType

protected computeType()

method computeView

protected computeView()

method computeYAxis

protected computeYAxis()

method computedStacked

protected computedStacked()

method height

public height(): number

method width

public width(): number

interface GraphMetricWidgetArgs

interface GraphMetricWidgetArgs extends MetricWidgetArgs

property alarm

alarm?: pulumi.Input<string> | WidgetAlarm;

Used to show a graph of a single alarm. If, instead, you want to place horizontal lines in graphs to show the trigger point of an alarm, then add the alarm to [annotations] instead.

At least one of [alarm], [annotations] or [metrics] must be supplied.

property annotations

annotations?: WidgetAnnotation | WidgetAnnotation[];

A single metric widget can have up to one alarm, and multiple horizontal and vertical annotations.

An alarm annotation is required only when metrics is not specified. A horizontal or vertical annotation is not required.

Instances of this interface include [aws.cloudwatch.Alarm], [AlarmAnnotation], [HorizontalAnnotation] and [VerticalAnnotation].

At least one of [alarm], [annotations] or [metrics] must be supplied.

property extendedStatistic

extendedStatistic?: pulumi.Input<number>;

The percentile statistic for the metric associated with the alarm. Specify a value between [0.0] and [100].

property height

height?: undefined | number;

The height of the widget in grid units. The default is 6.

Valid Values: 1–1000

property metrics

metrics?: WidgetMetric | WidgetMetric[];

Specify a metrics array to include one or more metrics (without alarms), math expressions, or search expressions. One metrics array can include 0–100 metrics and expressions.

See [ExpressionWidgetMetric] and [Metric] to create instances that can be added to this array.

At least one of [alarm], [annotations] or [metrics] must be supplied.

property period

period?: pulumi.Input<number>;

The default period, in seconds, for all metrics in this widget. The period is the length of time represented by one data point on the graph. This default can be overridden within each metric definition. The default is 300.

property region

region?: pulumi.Input<aws.Region>;

The region of the metric. Defaults to the region of the stack if not specified.

property statistic

statistic?: pulumi.Input<MetricStatistic>;

The default statistic to be displayed for each metric in the array. This default can be overridden within the definition of each individual metric in the metrics array.

property title

title?: pulumi.Input<string>;

The title to be displayed for the graph or number.

property width

width?: undefined | number;

The width of the widget in grid units (in a 24-column grid). The default is 6.

Valid Values: 1–24

property yAxis

yAxis?: pulumi.Input<YAxis>;

Limits for the minimums and maximums of the y-axis. This applies to every metric being graphed, unless specific metrics override it.

interface HorizontalAlarmAnnotationArgs

interface HorizontalAlarmAnnotationArgs

property alarmDescription

alarmDescription: pulumi.Input<string | undefined>;

property threshold

threshold: pulumi.Input<number | undefined>;

class HorizontalAnnotation

 implements WidgetAnnotation

Horizontal annotations have several options for fill shading, including shading above the annotation line, shading below the annotation line, and “band” shading that appears between two linked annotation lines as part of a single band annotation

constructor

new HorizontalAnnotation(args: HorizontalAnnotationArgs)
new HorizontalAnnotation(args: HorizontalAlarmAnnotationArgs)

method addWidgetJson

public addWidgetJson(annotations: MetricWidgetAnnotationsJson): void

For internal use only.

interface HorizontalAnnotationArgs

interface HorizontalAnnotationArgs

property aboveEdge

aboveEdge: HorizontalEdge;

The metric value in the graph where the horizontal annotation line is to appear. If [belowEdge] is also provided, then this will produce a band annotation. In that case [fill] should not be provided.

property belowEdge

belowEdge?: HorizontalEdge;

The lower edge when using band shading.

property color

color?: undefined | string;

The six-digit HTML hex color code to be used for the annotation. This color is used for both the annotation line and the fill shading.

property fill

fill?: "above" | "below";

How to use fill shading with the annotation. Valid values are above for shading above the annotation, below for shading below the annotation. If fill is omitted, there is no shading.

The exception is an annotation with band shading (in which case [lowerEdge] is provided). These annotations always have shading between the two values, and any value for fill is ignored.

property visible

visible?: undefined | false | true;

Set this to true to have the annotation appear in the graph, or false to have it be hidden. The default is true.

property yAxis

yAxis?: "left" | "right";

If the graph includes multiple metrics, specifies whether the numbers in Value refer to the metric associated with the left Y-axis or the right Y-axis, . Valid values are right and left.

interface HorizontalAnnotationJson

interface HorizontalAnnotationJson extends BaseHorizontalAnnotationJson

property color

color: string | undefined;

property fill

fill: "above" | "below" | undefined;

property label

label: pulumi.Input<string | undefined>;

property value

value: pulumi.Input<number>;

property visible

visible: boolean | undefined;

property yAxis

yAxis: "right" | "left" | undefined;

interface HorizontalEdge

interface HorizontalEdge

property label

label?: pulumi.Input<string | undefined>;

A string that appears on the graph next to the annotation.

property value

value: pulumi.Input<number>;

The metric value in the graph where the horizontal annotation line is to appear. On a band shading annotation, the two values for Value define the upper and lower edges of the band.

On a graph with horizontal annotations, the graph is scaled so that all visible horizontal annotations appear on the graph.

class LineGraphMetricWidget

 implements Widget

Displays a set of metrics as a line graph.

constructor

new LineGraphMetricWidget(args: GraphMetricWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method computeProperties

protected computeProperties(region: pulumi.Output<aws.Region>)

method computeType

protected computeType()

method computeView

protected computeView()

method computeYAxis

protected computeYAxis()

method computedStacked

protected computedStacked(): boolean

method height

public height(): number

method width

public width(): number

class LogWidget

 implements Widget

Simple widget that displays a cloudwatch log query onn the dashboard grid.

constructor

new LogWidget(args: LogWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method computeProperties

protected computeProperties(region: pulumi.Output<aws.Region>)

method computeType

protected computeType()

method computeView

protected computeView()

method computedStacked

protected computedStacked(): boolean

method height

public height(): number

method width

public width(): number

interface LogWidgetArgs

interface LogWidgetArgs extends SimpleWidgetArgs

property height

height?: undefined | number;

The height of the widget in grid units. The default is 6.

Valid Values: 1–1000

property query

query: pulumi.Input<string>;

Used to show a graph of a single query in a timeseries or singlevalue

property region

region?: pulumi.Input<aws.Region>;

The region of the metric. Defaults to the region of the stack if not specified.

property title

title?: pulumi.Input<string>;

The title to be displayed for the graph or number.

property width

width?: undefined | number;

The width of the widget in grid units (in a 24-column grid). The default is 6.

Valid Values: 1–24

interface LogWidgetJson

interface LogWidgetJson extends WidgetJson

property height

height: pulumi.Input<number>;

property properties

properties: pulumi.Input<LogWidgetPropertiesJson>;

property type

type: pulumi.Input<"log">;

property width

width: pulumi.Input<number>;

property x

x: pulumi.Input<number>;

property y

y: pulumi.Input<number>;

interface LogWidgetPropertiesJson

interface LogWidgetPropertiesJson

property query

query: pulumi.Input<string>;

property region

region: pulumi.Input<string | undefined>;

property stacked

stacked: pulumi.Input<boolean | undefined>;

property title

title: pulumi.Input<string | undefined>;

property view

view: pulumi.Input<"timeSeries" | "singleValue" | undefined>;

class Metric

class Metric

Metrics are the fundamental concept in CloudWatch. A metric represents a time-ordered set of data points that are published to CloudWatch. Think of a metric as a variable to monitor, and the data points as representing the values of that variable over time. For example, the CPU usage of a particular EC2 instance is one metric provided by Amazon EC2. The data points themselves can come from any application or business activity from which you collect data.

AWS services send metrics to CloudWatch, and you can send your own custom metrics to CloudWatch. You can add the data points in any order, and at any rate you choose. You can retrieve statistics about those data points as an ordered set of time-series data.

Metrics exist only in the region in which they are created. Metrics cannot be deleted, but they automatically expire after 15 months if no new data is published to them. Data points older than 15 months expire on a rolling basis; as new data points come in, data older than 15 months is dropped.

Metrics are uniquely defined by a name, a namespace, and zero or more dimensions. Each data point in a metric has a time stamp, and (optionally) a unit of measure. You can retrieve statistics from CloudWatch for any metric.

see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Metric for more details.

constructor

new Metric(args: MetricArgs, resource?: pulumi.Resource)
  • resource Optional resource this is a metric for. This is only used for parenting purposes. i.e. if an [Alarm] is created from this [Metric], then [resource] will be used as the parent of the alarm by default.

method addWidgetJson

public addWidgetJson(metrics: wjson.MetricJson[]): void

For internal use only.

method createAlarm

public createAlarm(name: string, args: AlarmArgs, opts: CustomResourceOptions): MetricAlarm

method with

public with(change: MetricChange | undefined): Metric

method withColor

public withColor(color: pulumi.Input<string> | undefined): Metric

method withDimensions

public withDimensions(dimensions: pulumi.Input<Record<string, pulumi.Input<string>>> | undefined): Metric

Produces a new [Metric] instances with the specific [dimensions] of this instance overwritten with the [dimensions] pass in as arguments. Because this is a merging, to unset a particular dimension, pass in an explicit value of { name: undefined }. To clear all dimensions, pass in undefined for the entire argument.

method withExtendedStatistic

public withExtendedStatistic(extendedStatistic: pulumi.Input<number> | undefined): Metric

method withLabel

public withLabel(label: pulumi.Input<string> | undefined): Metric

method withPeriod

public withPeriod(period: pulumi.Input<number> | undefined): Metric

method withStatistic

public withStatistic(statistic: pulumi.Input<MetricStatistic> | undefined): Metric

method withUnit

public withUnit(unit: pulumi.Input<MetricUnit> | undefined): Metric

method withVisible

public withVisible(visible: pulumi.Input<boolean> | undefined): Metric

method withYAxis

public withYAxis(yAxis: pulumi.Input<"left" | "right"> | undefined): Metric

property color

public color: pulumi.Output<string | undefined>;

The six-digit HTML hex color code to be used for this metric.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property dimensions

public dimensions: pulumi.Output<Record<string, string>> | undefined;

The dimensions for this metric. For the list of available dimensions see the AWS documentation here.

property extendedStatistic

public extendedStatistic: pulumi.Output<number | undefined>;

The percentile statistic for the metric associated with the alarm. Specify a value between [0.0] and [100].

property label

public label: pulumi.Output<string | undefined>;

The label to display for this metric in the graph legend. If this is not specified, the metric is given an autogenerated label that distinguishes it from the other metrics in the widget.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property name

public name: pulumi.Output<string>;

The name for this metric. See docs for supported metrics.

property namespace

public namespace: pulumi.Output<string>;

The namespace for this metric. See docs for the list of namespaces. See docs for supported metrics.

property period

public period: pulumi.Output<number>;

The period in seconds over which the specified [statistic] is applied. Must be in multiples of 60. Periods are defined in numbers of seconds, and valid values for period are 1, 5, 10, 30, or any multiple of 60. For example, to specify a period of six minutes, use 360 as the period value. You can adjust how the data is aggregated by varying the length of the period. A period can be as short as one second or as long as one day (86,400 seconds). The default value is 60 seconds.

See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html for more details.

property resource

public resource: Resource | undefined;

Optional resource this is a metric for. Used only for parenting purposes when making new alarms.

property statistic

public statistic: pulumi.Output<MetricStatistic>;

The statistic to apply to the alarm’s associated metric. Either of the following is supported: SampleCount, Average, Sum, Minimum, Maximum.

Defaults to [Average] if [statistic] and [extendedStatistic] is unspecified.

property unit

public unit: pulumi.Output<MetricUnit | undefined>;

The unit for this metric.

See https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html

property visible

public visible: pulumi.Output<boolean>;

Set this to true to have the metric appear in the graph, or false to have it be hidden. The default is true.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property yAxis

public yAxis: pulumi.Output<"left" | "right">;

Where on the graph to display the y-axis for this metric. The default is left.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

interface MetricArgs

interface MetricArgs

property color

color?: pulumi.Input<string | undefined>;

The six-digit HTML hex color code to be used for this metric.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property dimensions

dimensions?: pulumi.Input<Record<string, pulumi.Input<string>>>;

The dimensions for this metric. For the list of available dimensions see the AWS documentation here.

property extendedStatistic

extendedStatistic?: pulumi.Input<number | undefined>;

The percentile statistic for the metric associated with the alarm. Specify a value between [0.0] and [100].

property label

label?: pulumi.Input<string | undefined>;

The label to display for this metric in the graph legend. If this is not specified, the metric is given an autogenerated label that distinguishes it from the other metrics in the widget.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property name

name: pulumi.Input<string>;

The name for this metric. See docs for supported metrics.

property namespace

namespace: pulumi.Input<string>;

The namespace for this metric. See docs for the list of namespaces. See docs for supported metrics.

property period

period?: pulumi.Input<number | undefined>;

The period in seconds over which the specified stat is applied. Must be in multiples of 60. Default to [300] if unspecified.

property statistic

statistic?: pulumi.Input<MetricStatistic | undefined>;

The statistic to apply to the alarm’s associated metric. Either of the following is supported: SampleCount, Average, Sum, Minimum, Maximum

property unit

unit?: pulumi.Input<MetricUnit | undefined>;

The unit for this metric.

See https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html

property visible

visible?: pulumi.Input<boolean | undefined>;

Set this to true to have the metric appear in the graph, or false to have it be hidden. The default is true.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property yAxis

yAxis?: pulumi.Input<"left" | "right" | undefined>;

Where on the graph to display the y-axis for this metric. The default is left.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

interface MetricChange

interface MetricChange

Interface for all the parts of a metric that can be changed.

property color

color?: pulumi.Input<string>;

The six-digit HTML hex color code to be used for this metric.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property dimensions

dimensions?: pulumi.Input<Record<string, pulumi.Input<string>>>;

The new dimension for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be cleared.

property extendedStatistic

extendedStatistic?: pulumi.Input<number>;

The new percentile statistic for the metric associated with the alarm. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.

property label

label?: pulumi.Input<string>;

The label to display for this metric in the graph legend. If this is not specified, the metric is given an autogenerated label that distinguishes it from the other metrics in the widget.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property period

period?: pulumi.Input<number>;

The new period in seconds over which the specified stat is applied. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default (300s).

property statistic

statistic?: pulumi.Input<MetricStatistic>;

The new statistic to apply to the alarm’s associated metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.

property unit

unit?: pulumi.Input<MetricUnit>;

The new unit for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.

property visible

visible?: pulumi.Input<boolean>;

Set this to true to have the metric appear in the graph, or false to have it be hidden. The default is true.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property yAxis

yAxis?: pulumi.Input<"left" | "right">;

Where on the graph to display the y-axis for this metric. The default is left.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

type MetricJson

type MetricJson = SingleMetricJson | ExpressionMetricJson;

namespace metrics

namespace events

type CloudWatchEventMetricName

type CloudWatchEventMetricName = "DeadLetterInvocations" | "Invocations" | "FailedInvocations" | "TriggeredRules" | "MatchedEvents" | "ThrottledRules";

interface CloudWatchMetricChange

interface CloudWatchMetricChange extends MetricChange

property color

color?: pulumi.Input<string>;

The six-digit HTML hex color code to be used for this metric.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property dimensions

dimensions?: pulumi.Input<Record<string, pulumi.Input<string>>>;

The new dimension for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be cleared.

property eventRule

eventRule?: aws.cloudwatch.EventRule;

Filters down events to those from the specified [EventRule].

property extendedStatistic

extendedStatistic?: pulumi.Input<number>;

The new percentile statistic for the metric associated with the alarm. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.

property label

label?: pulumi.Input<string>;

The label to display for this metric in the graph legend. If this is not specified, the metric is given an autogenerated label that distinguishes it from the other metrics in the widget.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property period

period?: pulumi.Input<number>;

The new period in seconds over which the specified stat is applied. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default (300s).

property statistic

statistic?: pulumi.Input<MetricStatistic>;

The new statistic to apply to the alarm’s associated metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.

property unit

unit?: pulumi.Input<MetricUnit>;

The new unit for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.

property visible

visible?: pulumi.Input<boolean>;

Set this to true to have the metric appear in the graph, or false to have it be hidden. The default is true.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property yAxis

yAxis?: pulumi.Input<"left" | "right">;

Where on the graph to display the y-axis for this metric. The default is left.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

function deadLetterInvocations

deadLetterInvocations(change?: CloudWatchMetricChange): Metric

Measures the number of times a rule’s target is not invoked in response to an event. This includes invocations that would result in triggering the same rule again, causing an infinite loop.

Valid Dimensions: RuleName Units: Count

function failedInvocations

failedInvocations(change?: CloudWatchMetricChange): Metric

Measures the number of invocations that failed permanently. This does not include invocations that are retried, or that succeeded after a retry attempt. It also does not count failed invocations that are counted in DeadLetterInvocations.

Valid Dimensions: RuleName Units: Count

function invocations

invocations(change?: CloudWatchMetricChange): Metric

Measures the number of times a target is invoked for a rule in response to an event. This includes successful and failed invocations, but does not include throttled or retried attempts until they fail permanently. It does not include DeadLetterInvocations.

Note: CloudWatch Events only sends this metric to CloudWatch if it has a non-zero value.

Valid Dimensions: RuleName Units: Count

function matchedEvents

matchedEvents(change?: CloudWatchMetricChange): Metric

Measures the number of events that matched with any rule.

Valid Dimensions: None Units: Count

function metric

metric(metricName: CloudWatchEventMetricName, change: CloudWatchMetricChange): Metric

CloudWatch Events sends metrics to Amazon CloudWatch every minute.

Creates an AWS/Events metric with the requested [metricName]. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatch-Events-Monitoring-CloudWatch-Metrics.html for list of all metric-names.

Note, individual metrics can easily be obtained without supplying the name using the other [metricXXX] functions.

All of these metrics use Count as the unit, so Sum and SampleCount are the most useful statistics.

CloudWatch Events metrics have one dimension:

  1. “RuleName”: Filters the available metrics by rule name.

function throttledRules

throttledRules(change?: CloudWatchMetricChange): Metric

Measures the number of triggered rules that are being throttled.

Valid Dimensions: RuleName Units: Count

function triggeredRules

triggeredRules(change?: CloudWatchMetricChange): Metric

Measures the number of triggered rules that matched with any event.

Valid Dimensions: RuleName Units: Count

namespace logs

type CloudWatchLogMetricName

type CloudWatchLogMetricName = "IncomingBytes" | "IncomingLogEvents" | "ForwardedBytes" | "ForwardedLogEvents" | "DeliveryErrors" | "DeliveryThrottling";

interface CloudWatchMetricChange

interface CloudWatchMetricChange extends MetricChange

property color

color?: pulumi.Input<string>;

The six-digit HTML hex color code to be used for this metric.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property destinationType

destinationType?: undefined | string;

The subscription destination for the CloudWatch Logs data, which can be AWS Lambda, Amazon Kinesis Data Streams, or Amazon Kinesis Data Firehose.

property dimensions

dimensions?: pulumi.Input<Record<string, pulumi.Input<string>>>;

The new dimension for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be cleared.

property extendedStatistic

extendedStatistic?: pulumi.Input<number>;

The new percentile statistic for the metric associated with the alarm. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.

property filterName

filterName?: undefined | string;

The name of the subscription filter that is forwarding data from the log group to the destination. The subscription filter name is automatically converted by CloudWatch to ASCII and any unsupported characters get replaced with a question mark (?).

property label

label?: pulumi.Input<string>;

The label to display for this metric in the graph legend. If this is not specified, the metric is given an autogenerated label that distinguishes it from the other metrics in the widget.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property logGroup

logGroup?: aws.cloudwatch.LogGroup;

Filters down events to those from the specified [LogGroup].

property period

period?: pulumi.Input<number>;

The new period in seconds over which the specified stat is applied. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default (300s).

property statistic

statistic?: pulumi.Input<MetricStatistic>;

The new statistic to apply to the alarm’s associated metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.

property unit

unit?: pulumi.Input<MetricUnit>;

The new unit for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.

property visible

visible?: pulumi.Input<boolean>;

Set this to true to have the metric appear in the graph, or false to have it be hidden. The default is true.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

property yAxis

yAxis?: pulumi.Input<"left" | "right">;

Where on the graph to display the y-axis for this metric. The default is left.

Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].

function deliveryErrors

deliveryErrors(change?: CloudWatchMetricChange): Metric

The number of log events for which CloudWatch Logs received an error when forwarding data to the subscription destination.

Valid Dimensions: LogGroupName, DestinationType, FilterName Valid Statistic: Sum Units: None

function deliveryThrottling

deliveryThrottling(change?: CloudWatchMetricChange): Metric

The number of log events for which CloudWatch Logs was throttled when forwarding data to the subscription destination.

Valid Dimensions: LogGroupName, DestinationType, FilterName Valid Statistic: Sum Units: None

function forwardedBytes

forwardedBytes(change?: CloudWatchMetricChange): Metric

The volume of log events in compressed bytes forwarded to the subscription destination.

Valid Dimensions: LogGroupName, DestinationType, FilterName Valid Statistic: Sum Units: Bytes

function forwardedLogEvents

forwardedLogEvents(change?: CloudWatchMetricChange): Metric

The number of log events forwarded to the subscription destination.

Valid Dimensions: LogGroupName, DestinationType, FilterName Valid Statistic: Sum Units: None

function incomingBytes

incomingBytes(change?: CloudWatchMetricChange): Metric

The volume of log events in uncompressed bytes uploaded to CloudWatch Logs. When used with the LogGroupName dimension, this is the volume of log events in uncompressed bytes uploaded to the log group.

Valid Dimensions: LogGroupName Valid Statistic: Sum Units: Bytes

function incomingLogEvents

incomingLogEvents(change?: CloudWatchMetricChange): Metric

The number of log events uploaded to CloudWatch Logs. When used with the LogGroupName dimension, this is the number of log events uploaded to the log group.

Valid Dimensions: LogGroupName Valid Statistic: Sum Units: None

function metric

metric(metricName: CloudWatchLogMetricName, change: CloudWatchMetricChange): Metric

CloudWatch Logs sends metrics to Amazon CloudWatch every minute.

Creates an AWS/Logs metric with the requested [metricName]. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Monitoring-CloudWatch-Metrics.html for list of all metric-names.

Note, individual metrics can easily be obtained without supplying the name using the other [metricXXX] functions.

The dimensions that you can use with CloudWatch Logs metrics are:

  1. “LogGroupName”: The name of the CloudWatch Logs log group for which to display metrics.
  2. “DestinationType”: The subscription destination for the CloudWatch Logs data, which can be AWS Lambda, Amazon Kinesis Data Streams, or Amazon Kinesis Data Firehose.
  3. “FilterName”: The name of the subscription filter that is forwarding data from the log group to the destination. The subscription filter name is automatically converted by CloudWatch to ASCII and any unsupported characters get replaced with a question mark (?).

type MetricStatistic

type MetricStatistic = "SampleCount" | "Average" | "Sum" | "Minimum" | "Maximum";

type MetricUnit

type MetricUnit = "Seconds" | "Microseconds" | "Milliseconds" | "Bytes" | "Kilobytes" | "Megabytes" | "Gigabytes" | "Terabytes" | "Bits" | "Kilobits" | "Megabits" | "Gigabits" | "Terabits" | "Percent" | "Count" | "Bytes/Second" | "Kilobytes/Second" | "Megabytes/Second" | "Gigabytes/Second" | "Terabytes/Second" | "Bits/Second" | "Kilobits/Second" | "Megabits/Second" | "Gigabits/Second" | "Terabits/Second" | "Count/Second" | "None";

class MetricWidget

 implements Widget

Base type for widgets that display data from a set of [Metric]s. See [LineGraphMetricWidget], [StackedAreaGraphMetricWidget] and [SingleNumberMetricWidget] as concrete [Widget] instances for displaying [Metric]s.

constructor

new MetricWidget(metricArgs: MetricWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method computeProperties

protected computeProperties(region: pulumi.Output<aws.Region>)

method computeType

protected computeType()

method computeView

protected computeView()

method computeYAxis

protected computeYAxis()

method computedStacked

protected computedStacked()

method height

public height(): number

method width

public width(): number

interface MetricWidgetAnnotationsJson

interface MetricWidgetAnnotationsJson

property alarms

alarms?: pulumi.Input<string>[];

property horizontal

horizontal?: BaseHorizontalAnnotationJson[];

property vertical

vertical?: BaseVerticalAnnotationJson[];

interface MetricWidgetArgs

interface MetricWidgetArgs extends SimpleWidgetArgs

property alarm

alarm?: pulumi.Input<string> | WidgetAlarm;

Used to show a graph of a single alarm. If, instead, you want to place horizontal lines in graphs to show the trigger point of an alarm, then add the alarm to [annotations] instead.

At least one of [alarm], [annotations] or [metrics] must be supplied.

property annotations

annotations?: WidgetAnnotation | WidgetAnnotation[];

A single metric widget can have up to one alarm, and multiple horizontal and vertical annotations.

An alarm annotation is required only when metrics is not specified. A horizontal or vertical annotation is not required.

Instances of this interface include [aws.cloudwatch.Alarm], [AlarmAnnotation], [HorizontalAnnotation] and [VerticalAnnotation].

At least one of [alarm], [annotations] or [metrics] must be supplied.

property extendedStatistic

extendedStatistic?: pulumi.Input<number>;

The percentile statistic for the metric associated with the alarm. Specify a value between [0.0] and [100].

property height

height?: undefined | number;

The height of the widget in grid units. The default is 6.

Valid Values: 1–1000

property metrics

metrics?: WidgetMetric | WidgetMetric[];

Specify a metrics array to include one or more metrics (without alarms), math expressions, or search expressions. One metrics array can include 0–100 metrics and expressions.

See [ExpressionWidgetMetric] and [Metric] to create instances that can be added to this array.

At least one of [alarm], [annotations] or [metrics] must be supplied.

property period

period?: pulumi.Input<number>;

The default period, in seconds, for all metrics in this widget. The period is the length of time represented by one data point on the graph. This default can be overridden within each metric definition. The default is 300.

property region

region?: pulumi.Input<aws.Region>;

The region of the metric. Defaults to the region of the stack if not specified.

property statistic

statistic?: pulumi.Input<MetricStatistic>;

The default statistic to be displayed for each metric in the array. This default can be overridden within the definition of each individual metric in the metrics array.

property title

title?: pulumi.Input<string>;

The title to be displayed for the graph or number.

property width

width?: undefined | number;

The width of the widget in grid units (in a 24-column grid). The default is 6.

Valid Values: 1–24

interface MetricWidgetJson

interface MetricWidgetJson extends WidgetJson

property height

height: pulumi.Input<number>;

property properties

properties: pulumi.Input<MetricWidgetPropertiesJson>;

property type

type: pulumi.Input<"metric">;

property width

width: pulumi.Input<number>;

property x

x: pulumi.Input<number>;

property y

y: pulumi.Input<number>;

interface MetricWidgetPropertiesJson

interface MetricWidgetPropertiesJson

property annotations

annotations: MetricWidgetAnnotationsJson | undefined;

property metrics

metrics: MetricJson[] | undefined;

property period

period: pulumi.Input<number> | undefined;

property region

region: pulumi.Input<string | undefined>;

property stacked

stacked: pulumi.Input<boolean | undefined>;

property stat

stat: pulumi.Input<string>;

property title

title: pulumi.Input<string> | undefined;

property view

view: pulumi.Input<"timeSeries" | "singleValue" | undefined>;

property yAxis

yAxis: pulumi.Input<YAxis> | undefined;

interface MinMax

interface MinMax

property max

max?: undefined | number;

The maximum value for this Y-axis

property min

min?: undefined | number;

The minimum value for this Y-axis

interface RenderingPropertiesJson

interface RenderingPropertiesJson

property color

color: string | undefined;

property label

label: string | undefined;

property period

period: number | undefined;

property stat

stat: string | undefined;

property visible

visible: boolean | undefined;

property yAxis

yAxis: "right" | "left" | undefined;

class RowWidget

 implements Widget

Represents a horizontal sequence of [Widget]s in the [Dashboard]. Widgets are laid out horizontally in the grid until it would go past the max width of 24 columns. When that happens, the widgets will wrap to the next available grid row.

Rows must start in the leftmost grid column.

The final width of this widget will be the furthest column that a widget is placed at prior to wrapping. The final height of this widget will be the bottommost row that a widget is placed at.

constructor

new RowWidget(widgets: Widget[])

method addWidget

public addWidget(widget: Widget): void

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method getWidgetRelativePositions

protected getWidgetRelativePositions(): Map<Widget, WidgetRelativePosition>

method height

public height(): number

method width

public width(): number

property widgets

protected widgets: Widget[] = [];

class SimpleWidget

 implements Widget

Base type of all non-flow Widgets to place in a DashboardGrid.

constructor

new SimpleWidget(args: SimpleWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method height

public height(): number

method width

public width(): number

interface SimpleWidgetArgs

interface SimpleWidgetArgs

property height

height?: undefined | number;

The height of the widget in grid units. The default is 6.

Valid Values: 1–1000

property width

width?: undefined | number;

The width of the widget in grid units (in a 24-column grid). The default is 6.

Valid Values: 1–24

type SingleMetricJson

type SingleMetricJson = pulumi.Output<string | RenderingPropertiesJson[]>;

class SingleNumberMetricWidget

 implements Widget

Displays a set of metrics as a single number.

constructor

new SingleNumberMetricWidget(args: MetricWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method computeProperties

protected computeProperties(region: pulumi.Output<aws.Region>)

method computeType

protected computeType()

method computeView

protected computeView()

method computeYAxis

protected computeYAxis()

method computedStacked

protected computedStacked(): boolean

method height

public height(): number

method width

public width(): number

class SpaceWidget

 implements Widget

Simple [Widget] that can be used for putting space between other widgets in the [Dashboard].

constructor

new SpaceWidget(width: number, height: number)
new SpaceWidget(args: SimpleWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number): void

method height

public height(): number

method width

public width(): number

class StackedAreaGraphMetricWidget

 implements Widget

Displays a set of metrics as a stacked area graph.

constructor

new StackedAreaGraphMetricWidget(args: GraphMetricWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method computeProperties

protected computeProperties(region: pulumi.Output<aws.Region>)

method computeType

protected computeType()

method computeView

protected computeView()

method computeYAxis

protected computeYAxis()

method computedStacked

protected computedStacked(): boolean

method height

public height(): number

method width

public width(): number

class TextWidget

 implements Widget

Simple widget that displays a piece of text in the dashboard grid.

constructor

new TextWidget(markdown: string)
new TextWidget(args: TextWidgetArgs)

method addWidgetJson

public addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

For internal use only.

method computeProperties

protected computeProperties(region: pulumi.Output<aws.Region>)

method computeType

protected computeType()

method height

public height(): number

method width

public width(): number

interface TextWidgetArgs

interface TextWidgetArgs extends SimpleWidgetArgs

property height

height?: undefined | number;

The height of the widget in grid units. The default is 6.

Valid Values: 1–1000

property markdown

markdown: pulumi.Input<string>;

The text to be displayed by the widget.

property width

width?: undefined | number;

The width of the widget in grid units (in a 24-column grid). The default is 6.

Valid Values: 1–24

interface TextWidgetJson

interface TextWidgetJson extends WidgetJson

property height

height: pulumi.Input<number>;

property properties

properties: pulumi.Input<{
    markdown: pulumi.Input<string>;
}>;

property type

type: pulumi.Input<"text">;

property width

width: pulumi.Input<number>;

property x

x: pulumi.Input<number>;

property y

y: pulumi.Input<number>;

class VerticalAnnotation

 implements WidgetAnnotation

Vertical annotations have several options for fill shading, including shading before the annotation line, shading after the annotation line, and “band” shading that appears between two linked annotation lines as part of a single band annotation

constructor

new VerticalAnnotation(args: VerticalAnnotationArgs)

method addWidgetJson

public addWidgetJson(annotations: MetricWidgetAnnotationsJson): void

For internal use only.

interface VerticalAnnotationArgs

interface VerticalAnnotationArgs

For each vertical annotation, you can choose to have fill shading before the annotation, after it, or between two vertical lines that are linked as a single band annotation.

property afterEdge

afterEdge?: VerticalEdge;

The ending edge when using band shading.

property beforeEdge

beforeEdge: VerticalEdge;

The metric value in the graph where the vertical annotation line is to appear. If [endEdge] is also provided, then this will produce a band annotation. In that case [fill] should not be provided.

property color

color?: undefined | string;

The six-digit HTML hex color code to be used for the annotation. This color is used for both the annotation line and the fill shading.

property fill

fill?: "before" | "after";

How to use fill shading with the annotation. Valid values are before for shading before the annotation, after for shading after the annotation. If fill is omitted, there is no shading.

The exception is an annotation with band shading. These annotations always have shading between the two values, and any value for [fill] is ignored.

property visible

visible?: undefined | false | true;

Set this to true to have the annotation appear in the graph, or false to have it be hidden. The default is true.

interface VerticalAnnotationJson

interface VerticalAnnotationJson extends BaseVerticalAnnotationJson

property color

color: string | undefined;

property fill

fill: "before" | "after" | undefined;

property label

label: pulumi.Input<string | undefined>;

property value

value: pulumi.Input<string>;

property visible

visible: boolean | undefined;

interface VerticalEdge

interface VerticalEdge

property label

label?: undefined | string;

A string that appears on the graph next to the annotation.

property value

value: string;

The date and time in the graph where the vertical annotation line is to appear. On a band shading annotation, the two values for Value define the beginning and ending edges of the band.

On a graph with vertical annotations, the graph is scaled so that all visible vertical annotations appear on the graph.

This is defined as a string in ISO 8601 format. For more information, see ISO 8601.

interface Widget

interface Widget

Base type for all [Widget]s that can be placed in a [DashboardGrid].

  1. [RowWidget] and [ColumnWidget] can be used to easily flow other Widgets in a horizontal or vertical direction.

  2. [TextWidget] can be used to add text labels easily to the grid.

  3. [SingleNumberMetricWidget] can be used to make a widget that displays information about a [Metric] as a single number.

  4. [LineGraphMetricWidget] and [StackedAreaGraphMetricWidget] can be used to display a series of metric values as a graph.

method addWidgetJson

addWidgetJson(widgetJsons: WidgetJson[], xOffset: number, yOffset: number, region: pulumi.Output<aws.Region>): void

Converts this widget to an appropriate JSON pojo. The [xOffset] and [yOffset] parameters specify where in the final [Dashboard] grid this [Widget] should be placed.

For internal use only.

method height

height(): number

The height of the widget in grid units. The default is 6.

Valid Values: 1–1000

method width

width(): number

The width of the widget in grid units (in a 24-column grid). The default is 6.

Valid Values: 1–24

Type: Integer

interface WidgetAlarm

interface WidgetAlarm

property arn

arn: pulumi.Input<string>;

interface WidgetAnnotation

interface WidgetAnnotation

Base interface for values that can be placed inside [MetricWidgetArgs.annotations]. Instances of this interface include [aws.cloudwatch.Alarm], [AlarmAnnotation], [HorizontalAnnotation] and [VerticalAnnotation].

method addWidgetJson

addWidgetJson(annotations: MetricWidgetAnnotationsJson): void

For internal use only. Only intended to be called by [MetricWidget].

interface WidgetJson

interface WidgetJson

property height

height: pulumi.Input<number>;

property properties

properties: Record<string, any>;

property type

type: pulumi.Input<"alarm" | "metric" | "text" | "log">;

property width

width: pulumi.Input<number>;

property x

x: pulumi.Input<number>;

property y

y: pulumi.Input<number>;

interface WidgetMetric

interface WidgetMetric

Base type for all objects that can be placed in the [metrics] array of [MetricWidgetArgs].

See [ExpressionWidgetMetric] and [Metric] to create instances that can be added to [MetricWidgetArgs.metrics].

method addWidgetJson

addWidgetJson(metrics: wjson.MetricJson[]): void

For internal use only. Only intended to be called by [MetricWidget].

interface YAxis

interface YAxis

property left

left?: MinMax;

Optional min and max settings for the left Y-axis.

property right

right?: MinMax;

Optional min and max settings for the right Y-axis.