CustomWidgetProps

class aws_cdk.aws_cloudwatch.CustomWidgetProps(*, function_arn, title, height=None, params=None, update_on_refresh=None, update_on_resize=None, update_on_time_range_change=None, width=None)

Bases: object

The properties for a CustomWidget.

Parameters:
  • function_arn (str) – The Arn of the AWS Lambda function that returns HTML or JSON that will be displayed in the widget.

  • title (str) – The title of the widget.

  • height (Union[int, float, None]) – Height of the widget. Default: - 6 for Alarm and Graph widgets. 3 for single value widgets where most recent value of a metric is displayed.

  • params (Optional[Any]) – Parameters passed to the lambda function. Default: - no parameters are passed to the lambda function

  • update_on_refresh (Optional[bool]) – Update the widget on refresh. Default: true

  • update_on_resize (Optional[bool]) – Update the widget on resize. Default: true

  • update_on_time_range_change (Optional[bool]) – Update the widget on time range change. Default: true

  • width (Union[int, float, None]) – Width of the widget, in a grid of 24 units wide. Default: 6

ExampleMetadata:

infused

Example:

# dashboard: cloudwatch.Dashboard


# Import or create a lambda function
fn = lambda_.Function.from_function_arn(dashboard, "Function", "arn:aws:lambda:us-east-1:123456789012:function:MyFn")

dashboard.add_widgets(cloudwatch.CustomWidget(
    function_arn=fn.function_arn,
    title="My lambda baked widget"
))

Attributes

function_arn

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

height

Height of the widget.

Default:

  • 6 for Alarm and Graph widgets.

3 for single value widgets where most recent value of a metric is displayed.

params

Parameters passed to the lambda function.

Default:
  • no parameters are passed to the lambda function

title

The title of the widget.

update_on_refresh

Update the widget on refresh.

Default:

true

update_on_resize

Update the widget on resize.

Default:

true

update_on_time_range_change

Update the widget on time range change.

Default:

true

width

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

Default:

6