aws-cdk-lib.aws_cloudwatch.CustomWidgetProps

interface CustomWidgetProps

LanguageType name
.NETAmazon.CDK.AWS.CloudWatch.CustomWidgetProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#CustomWidgetProps
Javasoftware.amazon.awscdk.services.cloudwatch.CustomWidgetProps
Pythonaws_cdk.aws_cloudwatch.CustomWidgetProps
TypeScript (source)aws-cdk-lib » aws_cloudwatch » CustomWidgetProps

The properties for a CustomWidget.

Example

declare const dashboard: cloudwatch.Dashboard;

// Import or create a lambda function
const fn = lambda.Function.fromFunctionArn(
  dashboard,
  'Function',
  'arn:aws:lambda:us-east-1:123456789012:function:MyFn',
);

dashboard.addWidgets(new cloudwatch.CustomWidget({
  functionArn: fn.functionArn,
  title: 'My lambda baked widget',
}));

Properties

NameTypeDescription
functionArnstringThe Arn of the AWS Lambda function that returns HTML or JSON that will be displayed in the widget.
titlestringThe title of the widget.
height?numberHeight of the widget.
params?anyParameters passed to the lambda function.
updateOnRefresh?booleanUpdate the widget on refresh.
updateOnResize?booleanUpdate the widget on resize.
updateOnTimeRangeChange?booleanUpdate the widget on time range change.
width?numberWidth of the widget, in a grid of 24 units wide.

functionArn

Type: string

The Arn of the AWS Lambda function that returns HTML or JSON that will be displayed in the widget.


title

Type: string

The title of the widget.


height?

Type: number (optional, default: 6 for Alarm and Graph widgets. 3 for single value widgets where most recent value of a metric is displayed.)

Height of the widget.


params?

Type: any (optional, default: no parameters are passed to the lambda function)

Parameters passed to the lambda function.


updateOnRefresh?

Type: boolean (optional, default: true)

Update the widget on refresh.


updateOnResize?

Type: boolean (optional, default: true)

Update the widget on resize.


updateOnTimeRangeChange?

Type: boolean (optional, default: true)

Update the widget on time range change.


width?

Type: number (optional, default: 6)

Width of the widget, in a grid of 24 units wide.