AWS code-library documentation change
Summary
Added list-available-resource-dimensions CLI documentation
Security assessment
Operational documentation about available metrics dimensions without security implications
Diff
diff --git a/code-library/latest/ug/cli_2_pi_code_examples.md b/code-library/latest/ug/cli_2_pi_code_examples.md index cfbbd2523..68a3274ce 100644 --- a//code-library/latest/ug/cli_2_pi_code_examples.md +++ b//code-library/latest/ug/cli_2_pi_code_examples.md @@ -25,0 +26,56 @@ Each example includes a link to the complete source code, where you can find ins +The following code example shows how to use `create-performance-analysis-report`. + +**AWS CLI** + + +**To create a performance analysis report** + +The following `create-performance-analysis-report` example creates a performance analysis report with the start time `1682969503` and end time `1682979503` for the database `db-abcdefg123456789`. + + + aws pi create-performance-analysis-report \ + --service-type RDS \ + --identifier db-abcdefg123456789 \ + --start-time 1682969503 \ + --end-time 1682979503 + + +Output: + + + { + "AnalysisReportId": "report-0234d3ed98e28fb17" + } + +For more information about creating performance analysis reports, see [Creating a performance analysis report in Performance Insights](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.UsingDashboard.CreatingPerfAnlysisReport.html) in the _Amazon RDS User Guide_ and [Creating a performance analysis report in Performance Insights](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.UsingDashboard.CreatingPerfAnlysisReport.html) in the _Amazon Aurora User Guide_. + + * For API details, see [CreatePerformanceAnalysisReport](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pi/create-performance-analysis-report.html) in _AWS CLI Command Reference_. + + + + +The following code example shows how to use `delete-performance-analysis-report`. + +**AWS CLI** + + +**To delete a performance analysis report** + +The following `delete-performance-analysis-report` example deletes the performance analysis report with the report ID `report-0d99cc91c4422ee61`. + + + aws pi delete-performance-analysis-report \ + --service-type RDS \ + --identifier db-abcdefg123456789 \ + --analysis-report-id report-0d99cc91c4422ee61 + + +This command produces no output. + +For more information about deleting performance analysis reports, see [Deleting a performance analysis report in Performance Insights](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.UsingDashboard.DeletePerfAnalysisReport.html) in the _Amazon RDS User Guide_ and [Deleting a performance analysis report in Performance Insights](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.UsingDashboard.DeletePerfAnalysisReport.html) in the _Amazon Aurora User Guide_. + + * For API details, see [DeletePerformanceAnalysisReport](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pi/delete-performance-analysis-report.html) in _AWS CLI Command Reference_. + + + + @@ -31 +87 @@ The following code example shows how to use `describe-dimension-keys`. -**To describe dimension keys** +**Example 1: To describe dimension keys** @@ -90,0 +147,35 @@ Output: +**Example 2: To find the SQL ID for statements contributing the most to DB load** + +The following `describe-dimension-keys` requests the SQL statement and SQL ID for the 10 statements that contributed the most to DB load. + + + aws pi describe-dimension-keys \ + --service-type RDS \ + --identifier db-abcdefg123456789 \ + --start-time 2023-05-01T00:00:00Z \ + --end-time 2023-05-01T01:00:00Z \ + --metric db.load.avg \ + --group-by '{"Group": "db.sql", "Dimensions": ["db.sql.id", "db.sql.statement"],"Limit": 10}' + + +Output: + + + { + "AlignedEndTime": 1.5270804E9, + "AlignedStartTime": 1.5270264E9, + "Identifier": "db-abcdefg123456789", + "MetricList": [ + { + "Keys": [ + { + "Dimensions": {"db.sql.id": "AKIAIOSFODNN7EXAMPLE", "db.sql.statement": "SELECT * FROM customers WHERE customer_id = 123"}, + "Total": 25.5,"Partitions": [12.3, 13.2] + } + ] + } + ] + } + +For more information about dimensions in Performance Insights, see [Database load](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.Overview.ActiveSessions.html) in the _Amazon RDS User Guide_ and [Database load](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.Overview.ActiveSessions.html) in the _Amazon Aurora User Guide_. + @@ -95,0 +187,114 @@ Output: +The following code example shows how to use `get-dimension-key-details`. + +**AWS CLI** + + +**To get details for a specified dimension group for a DB instance** + +The following `get-dimension-key-details` example retrieves the full text of a SQL statement for DB instance `db-10BCD2EFGHIJ3KL4M5NO6PQRS5`. The `--group` is `db.sql`, and the `--group-identifier` is `db.sql.id`. In this example, `example-sql-id` represents a SQL ID retrieved by using the `get-resource-metrics` or `describe-dimension-keys` operations. In this example, the dimensions details are available. Thus, Performance Insights retrieves the full text of the SQL statement, without truncating it. + + + aws pi get-dimension-key-details \ + --service-type RDS \ + --identifier db-10BCD2EFGHIJ3KL4M5NO6PQRS5 \ + --group db.sql \ + --group-identifier example-sql-id \ + --requested-dimensions statement + + +Output: + + + { + "Dimensions":[ + { + "Value": "SELECT e.last_name, d.department_name FROM employees e, departments d WHERE e.department_id=d.department_id", + "Dimension": "db.sql.statement", + "Status": "AVAILABLE" + }, + ... + ] + } + +For more information about dimensions in Performance Insights, see [Database load](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.Overview.ActiveSessions.html) in the _Amazon RDS User Guide_ and [Database load](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.Overview.ActiveSessions.html) in the _Amazon Aurora User Guide_. + + * For API details, see [GetDimensionKeyDetails](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pi/get-dimension-key-details.html) in _AWS CLI Command Reference_. + + + + +The following code example shows how to use `get-performance-analysis-report`. + +**AWS CLI** + + +**To get a performance analysis report** + +The following `get-performance-analysis-report` example gets the performance analysis report for the database `db-abcdefg123456789` with the report ID `report-0d99cc91c4422ee61`. The response provides the report status, ID, time details, and insights. + + + aws pi get-performance-analysis-report \ + --service-type RDS \ + --identifier db-abcdefg123456789 \ + --analysis-report-id report-0d99cc91c4422ee61 + + +Output: + + + { + "AnalysisReport": { + "Status": "Succeeded", + "ServiceType": "RDS", + "Identifier": "db-abcdefg123456789", + "StartTime": 1680583486.584, + "AnalysisReportId": "report-0d99cc91c4422ee61", + "EndTime": 1680587086.584, + "CreateTime": 1680587087.139, + "Insights": [ + ... (Condensed for space) + ] + } + } + +For more information about performance analysis reports, see [Analyzing database performance for a period of time](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.UsingDashboard.AnalyzePerformanceTimePeriod.html) in the _Amazon RDS User Guide_ and [Analyzing database performance for a period of time](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.UsingDashboard.AnalyzePerformanceTimePeriod.html) in the _Amazon Aurora User Guide_. + + * For API details, see [GetPerformanceAnalysisReport](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pi/get-performance-analysis-report.html) in _AWS CLI Command Reference_. + + + + +The following code example shows how to use `get-resource-metadata`. + +**AWS CLI** + + +**To get resource metadata for a database** + +The following `get-resource-metadata` example gets the resource metadata for the database `db-abcdefg123456789`. The response shows that SQL digest statistics are enabled. + + + aws pi get-resource-metadata \ + --service-type RDS \ + --identifier db-abcdefg123456789 + + +Output: + + + {