CloudTrail / Client / create_dashboard

create_dashboard#

CloudTrail.Client.create_dashboard(**kwargs)#

Creates a custom dashboard or the Highlights dashboard.

  • Custom dashboards - Custom dashboards allow you to query events in any event data store type. You can add up to 10 widgets to a custom dashboard. You can manually refresh a custom dashboard, or you can set a refresh schedule.

  • Highlights dashboard - You can create the Highlights dashboard to see a summary of key user activities and API usage across all your event data stores. CloudTrail Lake manages the Highlights dashboard and refreshes the dashboard every 6 hours. To create the Highlights dashboard, you must set and enable a refresh schedule.

CloudTrail runs queries to populate the dashboard’s widgets during a manual or scheduled refresh. CloudTrail must be granted permissions to run the StartQuery operation on your behalf. To provide permissions, run the PutResourcePolicy operation to attach a resource-based policy to each event data store. For more information, see Example: Allow CloudTrail to run queries to populate a dashboard in the CloudTrail User Guide.

To set a refresh schedule, CloudTrail must be granted permissions to run the StartDashboardRefresh operation to refresh the dashboard on your behalf. To provide permissions, run the PutResourcePolicy operation to attach a resource-based policy to the dashboard. For more information, see Resource-based policy example for a dashboard in the CloudTrail User Guide.

For more information about dashboards, see CloudTrail Lake dashboards in the CloudTrail User Guide.

See also: AWS API Documentation

Request Syntax

response = client.create_dashboard(
    Name='string',
    RefreshSchedule={
        'Frequency': {
            'Unit': 'HOURS'|'DAYS',
            'Value': 123
        },
        'Status': 'ENABLED'|'DISABLED',
        'TimeOfDay': 'string'
    },
    TagsList=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    TerminationProtectionEnabled=True|False,
    Widgets=[
        {
            'QueryStatement': 'string',
            'QueryParameters': [
                'string',
            ],
            'ViewProperties': {
                'string': 'string'
            }
        },
    ]
)
Parameters:
  • Name (string) –

    [REQUIRED]

    The name of the dashboard. The name must be unique to your account.

    To create the Highlights dashboard, the name must be AWSCloudTrail-Highlights.

  • RefreshSchedule (dict) –

    The refresh schedule configuration for the dashboard.

    To create the Highlights dashboard, you must set a refresh schedule and set the Status to ENABLED. The Unit for the refresh schedule must be HOURS and the Value must be 6.

    • Frequency (dict) –

      The frequency at which you want the dashboard refreshed.

      • Unit (string) –

        The unit to use for the refresh.

        For custom dashboards, the unit can be HOURS or DAYS.

        For the Highlights dashboard, the Unit must be HOURS.

      • Value (integer) –

        The value for the refresh schedule.

        For custom dashboards, the following values are valid when the unit is HOURS: 1, 6, 12, 24

        For custom dashboards, the only valid value when the unit is DAYS is 1.

        For the Highlights dashboard, the Value must be 6.

    • Status (string) –

      Specifies whether the refresh schedule is enabled. Set the value to ENABLED to enable the refresh schedule, or to DISABLED to turn off the refresh schedule.

    • TimeOfDay (string) –

      The time of day in UTC to run the schedule; for hourly only refer to minutes; default is 00:00.

  • TagsList (list) –

    A list of tags.

    • (dict) –

      A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel.

      • Key (string) – [REQUIRED]

        The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies.

      • Value (string) –

        The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.

  • TerminationProtectionEnabled (boolean) – Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.

  • Widgets (list) –

    An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.

    You do not need to specify widgets for the Highlights dashboard.

    • (dict) –

      Contains information about a widget on a CloudTrail Lake dashboard.

      • QueryStatement (string) – [REQUIRED]

        The query statement for the widget. For custom dashboard widgets, you can query across multiple event data stores as long as all event data stores exist in your account.

        Note

        When a query uses ? with eventTime, ? must be surrounded by single quotes as follows: '?'.

      • QueryParameters (list) –

        The optional query parameters. The following query parameters are valid: $StartTime$, $EndTime$, and $Period$.

        • (string) –

      • ViewProperties (dict) – [REQUIRED]

        The view properties for the widget. For more information about view properties, see View properties for widgets in the CloudTrail User Guide.

        • (string) –

          • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'DashboardArn': 'string',
    'Name': 'string',
    'Type': 'MANAGED'|'CUSTOM',
    'Widgets': [
        {
            'QueryAlias': 'string',
            'QueryStatement': 'string',
            'QueryParameters': [
                'string',
            ],
            'ViewProperties': {
                'string': 'string'
            }
        },
    ],
    'TagsList': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    'RefreshSchedule': {
        'Frequency': {
            'Unit': 'HOURS'|'DAYS',
            'Value': 123
        },
        'Status': 'ENABLED'|'DISABLED',
        'TimeOfDay': 'string'
    },
    'TerminationProtectionEnabled': True|False
}

Response Structure

  • (dict) –

    • DashboardArn (string) –

      The ARN for the dashboard.

    • Name (string) –

      The name of the dashboard.

    • Type (string) –

      The dashboard type.

    • Widgets (list) –

      An array of widgets for the dashboard.

      • (dict) –

        A widget on a CloudTrail Lake dashboard.

        • QueryAlias (string) –

          The query alias used to identify the query for the widget.

        • QueryStatement (string) –

          The SQL query statement for the widget.

        • QueryParameters (list) –

          The query parameters for the widget.

          • (string) –

        • ViewProperties (dict) –

          The view properties for the widget. For more information about view properties, see View properties for widgets in the CloudTrail User Guide..

          • (string) –

            • (string) –

    • TagsList (list) –

      A list of tags.

      • (dict) –

        A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel.

        • Key (string) –

          The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies.

        • Value (string) –

          The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.

    • RefreshSchedule (dict) –

      The refresh schedule for the dashboard, if configured.

      • Frequency (dict) –

        The frequency at which you want the dashboard refreshed.

        • Unit (string) –

          The unit to use for the refresh.

          For custom dashboards, the unit can be HOURS or DAYS.

          For the Highlights dashboard, the Unit must be HOURS.

        • Value (integer) –

          The value for the refresh schedule.

          For custom dashboards, the following values are valid when the unit is HOURS: 1, 6, 12, 24

          For custom dashboards, the only valid value when the unit is DAYS is 1.

          For the Highlights dashboard, the Value must be 6.

      • Status (string) –

        Specifies whether the refresh schedule is enabled. Set the value to ENABLED to enable the refresh schedule, or to DISABLED to turn off the refresh schedule.

      • TimeOfDay (string) –

        The time of day in UTC to run the schedule; for hourly only refer to minutes; default is 00:00.

    • TerminationProtectionEnabled (boolean) –

      Indicates whether termination protection is enabled for the dashboard.

Exceptions

  • CloudTrail.Client.exceptions.ConflictException

  • CloudTrail.Client.exceptions.InvalidTagParameterException

  • CloudTrail.Client.exceptions.EventDataStoreNotFoundException

  • CloudTrail.Client.exceptions.InactiveEventDataStoreException

  • CloudTrail.Client.exceptions.InsufficientEncryptionPolicyException

  • CloudTrail.Client.exceptions.InvalidQueryStatementException

  • CloudTrail.Client.exceptions.ServiceQuotaExceededException

  • CloudTrail.Client.exceptions.UnsupportedOperationException