Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Amazon RDS Performance Insights examples using AWS CLI

Focus mode
Amazon RDS Performance Insights examples using AWS CLI - AWS Command Line Interface

The following code examples show you how to perform actions and implement common scenarios by using the AWS Command Line Interface with Amazon RDS Performance Insights.

Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.

Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.

Topics

Actions

The following code example shows how to use describe-dimension-keys.

AWS CLI

To describe dimension keys

This example requests the names of all wait events. The data is summarized by event name, and the aggregate values of those events over the specified time period.

Command:

aws pi describe-dimension-keys --service-type RDS --identifier db-LKCGOBK26374TPTDFXOIWVCPPM --start-time 1527026400 --end-time 1527080400 --metric db.load.avg --group-by '{"Group":"db.wait_event"}'

Output:

{ "AlignedEndTime": 1.5270804E9, "AlignedStartTime": 1.5270264E9, "Keys": [ { "Dimensions": {"db.wait_event.name": "wait/synch/mutex/innodb/aurora_lock_thread_slot_futex"}, "Total": 0.05906906851195666 }, { "Dimensions": {"db.wait_event.name": "wait/io/aurora_redo_log_flush"}, "Total": 0.015824722186149193 }, { "Dimensions": {"db.wait_event.name": "CPU"}, "Total": 0.008014396230265477 }, { "Dimensions": {"db.wait_event.name": "wait/io/aurora_respond_to_client"}, "Total": 0.0036361612526204477 }, { "Dimensions": {"db.wait_event.name": "wait/io/table/sql/handler"}, "Total": 0.0019108398419382965 }, { "Dimensions": {"db.wait_event.name": "wait/synch/cond/mysys/my_thread_var::suspend"}, "Total": 8.533847837782684E-4 }, { "Dimensions": {"db.wait_event.name": "wait/io/file/csv/data"}, "Total": 6.864181956477376E-4 }, { "Dimensions": {"db.wait_event.name": "Unknown"}, "Total": 3.895887056379051E-4 }, { "Dimensions": {"db.wait_event.name": "wait/synch/mutex/sql/FILE_AS_TABLE::LOCK_shim_lists"}, "Total": 3.710368625122906E-5 }, { "Dimensions": {"db.wait_event.name": "wait/lock/table/sql/handler"}, "Total": 0 } ] }

The following code example shows how to use describe-dimension-keys.

AWS CLI

To describe dimension keys

This example requests the names of all wait events. The data is summarized by event name, and the aggregate values of those events over the specified time period.

Command:

aws pi describe-dimension-keys --service-type RDS --identifier db-LKCGOBK26374TPTDFXOIWVCPPM --start-time 1527026400 --end-time 1527080400 --metric db.load.avg --group-by '{"Group":"db.wait_event"}'

Output:

{ "AlignedEndTime": 1.5270804E9, "AlignedStartTime": 1.5270264E9, "Keys": [ { "Dimensions": {"db.wait_event.name": "wait/synch/mutex/innodb/aurora_lock_thread_slot_futex"}, "Total": 0.05906906851195666 }, { "Dimensions": {"db.wait_event.name": "wait/io/aurora_redo_log_flush"}, "Total": 0.015824722186149193 }, { "Dimensions": {"db.wait_event.name": "CPU"}, "Total": 0.008014396230265477 }, { "Dimensions": {"db.wait_event.name": "wait/io/aurora_respond_to_client"}, "Total": 0.0036361612526204477 }, { "Dimensions": {"db.wait_event.name": "wait/io/table/sql/handler"}, "Total": 0.0019108398419382965 }, { "Dimensions": {"db.wait_event.name": "wait/synch/cond/mysys/my_thread_var::suspend"}, "Total": 8.533847837782684E-4 }, { "Dimensions": {"db.wait_event.name": "wait/io/file/csv/data"}, "Total": 6.864181956477376E-4 }, { "Dimensions": {"db.wait_event.name": "Unknown"}, "Total": 3.895887056379051E-4 }, { "Dimensions": {"db.wait_event.name": "wait/synch/mutex/sql/FILE_AS_TABLE::LOCK_shim_lists"}, "Total": 3.710368625122906E-5 }, { "Dimensions": {"db.wait_event.name": "wait/lock/table/sql/handler"}, "Total": 0 } ] }

The following code example shows how to use get-resource-metrics.

AWS CLI

To get resource metrics

This example requests data points for the db.wait_event dimension group, and for the db.wait_event.name dimension within that group. In the response, the relevant data points are grouped by the requested dimension (db.wait_event.name).

Command:

aws pi get-resource-metrics --service-type RDS --identifier db-LKCGOBK26374TPTDFXOIWVCPPM --start-time 1527026400 --end-time 1527080400 --period-in-seconds 300 --metric db.load.avg --metric-queries file://metric-queries.json

The arguments for --metric-queries are stored in a JSON file, metric-queries.json. Here are the contents of that file:

[ { "Metric": "db.load.avg", "GroupBy": { "Group":"db.wait_event" } } ]

Output:

{ "AlignedEndTime": 1.5270804E9, "AlignedStartTime": 1.5270264E9, "Identifier": "db-LKCGOBK26374TPTDFXOIWVCPPM", "MetricList": [ { "Key": { "Metric": "db.load.avg" }, "DataPoints": [ { "Timestamp": 1527026700.0, "Value": 1.3533333333333333 }, { "Timestamp": 1527027000.0, "Value": 0.88 }, <...remaining output omitted...> ] }, { "Key": { "Metric": "db.load.avg", "Dimensions": { "db.wait_event.name": "wait/synch/mutex/innodb/aurora_lock_thread_slot_futex" } }, "DataPoints": [ { "Timestamp": 1527026700.0, "Value": 0.8566666666666667 }, { "Timestamp": 1527027000.0, "Value": 0.8633333333333333 }, <...remaining output omitted...> ], }, <...remaining output omitted...> ] }

The following code example shows how to use get-resource-metrics.

AWS CLI

To get resource metrics

This example requests data points for the db.wait_event dimension group, and for the db.wait_event.name dimension within that group. In the response, the relevant data points are grouped by the requested dimension (db.wait_event.name).

Command:

aws pi get-resource-metrics --service-type RDS --identifier db-LKCGOBK26374TPTDFXOIWVCPPM --start-time 1527026400 --end-time 1527080400 --period-in-seconds 300 --metric db.load.avg --metric-queries file://metric-queries.json

The arguments for --metric-queries are stored in a JSON file, metric-queries.json. Here are the contents of that file:

[ { "Metric": "db.load.avg", "GroupBy": { "Group":"db.wait_event" } } ]

Output:

{ "AlignedEndTime": 1.5270804E9, "AlignedStartTime": 1.5270264E9, "Identifier": "db-LKCGOBK26374TPTDFXOIWVCPPM", "MetricList": [ { "Key": { "Metric": "db.load.avg" }, "DataPoints": [ { "Timestamp": 1527026700.0, "Value": 1.3533333333333333 }, { "Timestamp": 1527027000.0, "Value": 0.88 }, <...remaining output omitted...> ] }, { "Key": { "Metric": "db.load.avg", "Dimensions": { "db.wait_event.name": "wait/synch/mutex/innodb/aurora_lock_thread_slot_futex" } }, "DataPoints": [ { "Timestamp": 1527026700.0, "Value": 0.8566666666666667 }, { "Timestamp": 1527027000.0, "Value": 0.8633333333333333 }, <...remaining output omitted...> ], }, <...remaining output omitted...> ] }

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.