This documentation is for Version 1 of the Amazon CLI only. For documentation related to Version 2 of the Amazon CLI, see the Version 2 User Guide.
Amazon RDS Performance Insights examples using Amazon CLI
The following code examples show you how to perform actions and implement common scenarios by using the Amazon 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
.
- Amazon 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
--identifierdb-LKCGOBK26374TPTDFXOIWVCPPM
--start-time1527026400
--end-time1527080400
--metricdb.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 } ] }
-
For API details, see DescribeDimensionKeys
in Amazon CLI Command Reference.
-
The following code example shows how to use get-resource-metrics
.
- Amazon 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
--identifierdb-LKCGOBK26374TPTDFXOIWVCPPM
--start-time1527026400
--end-time1527080400
--period-in-seconds300
--metricdb.load.avg
--metric-queriesfile://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...> ] }
-
For API details, see GetResourceMetrics
in Amazon CLI Command Reference.
-