ebook img

Amazon CloudWatch - User Guide PDF

215 Pages·2017·1.77 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Amazon CloudWatch - User Guide

Amazon CloudWatch User Guide Amazon CloudWatch User Guide Amazon CloudWatch: User Guide Copyright © 2022 Amazon Web Services, Inc. and/or its affiliates. All rights reserved. Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon. Amazon CloudWatch User Guide Table of Contents What is Amazon CloudWatch?............................................................................................................. 1 Accessing CloudWatch................................................................................................................ 1 Related AWS services .................................................................................................................. 1 How CloudWatch works .............................................................................................................. 2 Concepts................................................................................................................................... 2 Namespaces...................................................................................................................... 3 Metrics.............................................................................................................................. 3 Dimensions........................................................................................................................ 4 Resolution......................................................................................................................... 5 Statistics........................................................................................................................... 6 Units................................................................................................................................ 6 Periods............................................................................................................................. 6 Aggregation....................................................................................................................... 7 Percentiles......................................................................................................................... 7 Alarms.............................................................................................................................. 8 Billing and cost......................................................................................................................... 8 Analyze CloudWatch cost and usage data with Cost Explorer .................................................. 9 Analyze CloudWatch cost and usage data with AWS Cost and Usage Reports and Athena ............ 12 Best practices for optimizing and reducing costs .................................................................. 14 Resources................................................................................................................................ 23 Getting set up ................................................................................................................................. 24 Sign up for Amazon Web Services (AWS) ..................................................................................... 24 Sign in to the Amazon CloudWatch console ................................................................................. 24 Set up the AWS CLI .................................................................................................................. 24 Getting started ................................................................................................................................ 26 See key metrics from all AWS services ........................................................................................ 28 Remove a service from appearing in the cross-service dashboard ............................................ 29 Focus on a single service ........................................................................................................... 30 Focus on a resource group........................................................................................................ 31 Dashboards...................................................................................................................................... 32 Create a dashboard .................................................................................................................. 33 CloudWatch cross-account observability dashboard ...................................................................... 33 Cross-account cross-Region dashboards....................................................................................... 34 Creating and using a cross-account cross-Region dashboard with the AWS Management Console........................................................................................................................... 34 Create a cross-account cross-Region dashboard programmatically ........................................... 35 Creating and working with widgets on CloudWatch dashboards ...................................................... 37 Add or remove a graph .................................................................................................... 37 Graph metrics manually on a CloudWatch dashboard ........................................................... 39 Edit a graph .................................................................................................................... 40 Add an explorer widget to a CloudWatch dashboard ............................................................ 45 Add or remove a line widget ............................................................................................ 46 Add or remove a number widget ....................................................................................... 47 Add or remove a gauge widget ......................................................................................... 48 Add a custom widget to a CloudWatch dashboard ................................................................ 49 Add or remove a text widget ............................................................................................ 57 Add or remove an alarm widget........................................................................................ 57 Link and unlink graphs..................................................................................................... 58 Sharing dashboards.................................................................................................................. 59 Permissions required to share a dashboard .......................................................................... 59 Permissions that are granted to people who you share the dashboard with .............................. 60 Share a single dashboard with specific users ........................................................................ 61 Share a single dashboard publicly ...................................................................................... 61 Share all CloudWatch dashboards in the account by using SSO ............................................... 62 iii Amazon CloudWatch User Guide Set up SSO for CloudWatch dashboard sharing .................................................................... 62 See how many of your dashboards are shared ..................................................................... 63 See which of your dashboards are shared ............................................................................ 63 Stop sharing one or more dashboards ................................................................................ 64 Review shared dashboard permissions and change permission scope ....................................... 64 Allowing people that you share with to see composite alarms ................................................ 65 Allowing people that you share with to see logs table widgets ............................................... 66 Allowing people that you share with to see custom widgets ................................................... 67 Use live data........................................................................................................................... 68 Viewing an animated dashboard ................................................................................................ 69 Add a dashboard to your favorites list ....................................................................................... 69 Change the period override setting or refresh interval .................................................................. 70 Change the time range or time zone format ................................................................................ 70 Metrics............................................................................................................................................ 73 Basic monitoring and detailed monitoring................................................................................... 73 Query your metrics with CloudWatch Metrics Insights ................................................................... 74 Build your queries ............................................................................................................ 75 Query components and syntax ........................................................................................... 76 Create alarms on Metrics Insights queries ............................................................................ 81 Using Metrics Insights queries with metric math................................................................... 84 SQL inference.................................................................................................................. 84 Sample queries................................................................................................................ 85 Metrics Insights limits....................................................................................................... 91 Metrics Insights glossary ................................................................................................... 92 Troubleshooting Metrics Insights ........................................................................................ 92 Use metrics explorer to monitor resources by their tags and properties ........................................... 93 CloudWatch agent configuration for metrics explorer ............................................................ 94 Using metric streams ................................................................................................................ 94 Setting up a metric stream ................................................................................................ 95 Statistics that can be streamed .......................................................................................... 98 Metric stream operation and maintenance ........................................................................... 99 Monitoring your metric streams with CloudWatch metrics .................................................... 100 Trust between CloudWatch and Kinesis Data Firehose ......................................................... 100 Metric streams output formats ......................................................................................... 101 Troubleshooting............................................................................................................. 112 View available metrics ............................................................................................................. 112 Searching for available metrics ......................................................................................... 115 Graphing metrics.................................................................................................................... 116 Graphing a metric.......................................................................................................... 117 Using dynamic labels...................................................................................................... 120 Modifying the time range or time zone format for a graph .................................................. 122 Zooming in on a graph .................................................................................................. 124 Modifying the y-axis for a graph ...................................................................................... 125 Creating an alarm from a metric on a graph ...................................................................... 126 Using anomaly detection ......................................................................................................... 127 How anomaly detection works ......................................................................................... 129 Anomaly detection on metric math ................................................................................... 129 Using metric math.................................................................................................................. 130 Adding a math expression to a CloudWatch graph .............................................................. 130 Metric math syntax and functions ..................................................................................... 131 Using IF expressions ........................................................................................................ 148 Anomaly detection on metric math ................................................................................... 151 Using search expressions in graphs ........................................................................................... 151 Search expression syntax ................................................................................................. 152 Search expression examples ............................................................................................. 156 Creating a graph with a search expression ......................................................................... 158 Getting statistics for a metric ................................................................................................... 160 iv Amazon CloudWatch User Guide CloudWatch statistics definitions ...................................................................................... 160 Getting statistics for a specific resource ............................................................................. 163 Aggregating statistics across resources .............................................................................. 166 Aggregating statistics by Auto Scaling group ..................................................................... 167 Aggregating statistics by AMI ........................................................................................... 169 Publishing custom metrics....................................................................................................... 170 High-resolution metrics................................................................................................... 170 Using dimensions........................................................................................................... 171 Publishing single data points........................................................................................... 171 Publishing statistic sets................................................................................................... 172 Publishing the value zero ................................................................................................ 172 Stop publishing metrics.................................................................................................. 173 Alarms.......................................................................................................................................... 174 Metric alarm states................................................................................................................. 174 Evaluating an alarm................................................................................................................ 175 Alarm actions......................................................................................................................... 176 Configuring how alarms treat missing data ................................................................................ 176 How alarm state is evaluated when data is missing ............................................................. 177 High-resolution alarms............................................................................................................ 179 Alarms on math expressions .................................................................................................... 179 Percentile-based alarms and low data samples ........................................................................... 180 CloudWatch alarms and Amazon EventBridge ............................................................................ 180 Common features of CloudWatch alarms ................................................................................... 180 Setting up an SNS topic .......................................................................................................... 181 Setting up an Amazon SNS topic using the AWS Management Console .................................. 182 Setting up an SNS topic using the AWS CLI ....................................................................... 182 Create an alarm based on a static threshold .............................................................................. 184 Creating an alarm based on a Metrics Insights query ................................................................... 185 Creating an alarm based on anomaly detection .......................................................................... 185 Modifying an anomaly detection model ........................................................................... 188 Deleting an anomaly detection model ............................................................................... 188 Creating an alarm based on a log group-metric filter .................................................................. 189 Creating an alarm based on a metric math expression ................................................................. 190 Creating a composite alarm ..................................................................................................... 192 Creating a composite alarm ............................................................................................. 193 Composite alarm action suppression ................................................................................ 194 Editing or deleting a CloudWatch alarm .................................................................................... 199 Creating a CPU usage alarm .................................................................................................... 200 Setting up a CPU usage alarm using the AWS Management Console ...................................... 200 Setting up a CPU usage alarm using the AWS CLI ............................................................... 201 Creating a load balancer latency alarm ..................................................................................... 201 Setting up a latency alarm using the AWS Management Console .......................................... 202 Setting up a latency alarm using the AWS CLI .................................................................... 202 Creating a storage throughput alarm ........................................................................................ 203 Setting up a storage throughput alarm using the AWS Management Console .......................... 203 Setting up a storage throughput alarm using the AWS CLI ................................................... 204 Create alarms to stop, terminate, reboot, or recover an EC2 instance ............................................. 204 Adding stop actions to Amazon CloudWatch alarms ............................................................ 205 Adding terminate actions to Amazon CloudWatch alarms .................................................... 206 Adding reboot actions to Amazon CloudWatch alarms ......................................................... 207 Adding recover actions to Amazon CloudWatch alarms ........................................................ 208 Viewing the history of triggered alarms and actions ............................................................ 209 Creating a billing alarm ........................................................................................................... 210 Enabling billing alerts ..................................................................................................... 210 Creating a billing alarm ................................................................................................... 211 Deleting a billing alarm................................................................................................... 212 Hiding Auto Scaling alarms...................................................................................................... 212 v Amazon CloudWatch User Guide Alarm events and EventBridge ................................................................................................. 212 Sample events from CloudWatch ...................................................................................... 212 Application monitoring.................................................................................................................... 222 Using ServiceLens to monitor the health of your applications ....................................................... 222 Deploying ServiceLens..................................................................................................... 223 Using the service map ..................................................................................................... 232 Using the resource health view ........................................................................................ 233 ServiceLens troubleshooting ............................................................................................ 235 Using Internet Monitor............................................................................................................ 237 AWS Regions.................................................................................................................. 238 IAM policies................................................................................................................... 239 Pricing........................................................................................................................... 239 Components.................................................................................................................. 239 Getting started............................................................................................................... 240 Internet Monitor dashboard ............................................................................................. 248 CloudWatch Logs and Metrics .......................................................................................... 252 EventBridge integration................................................................................................... 255 How Internet Monitor works ............................................................................................ 256 Data protection and data privacy ..................................................................................... 258 Quotas.......................................................................................................................... 258 Using synthetic monitoring...................................................................................................... 258 Required roles and permissions ........................................................................................ 260 Creating a canary ........................................................................................................... 270 Groups.......................................................................................................................... 330 Troubleshooting a failed canary ....................................................................................... 331 Sample code for canary scripts ......................................................................................... 334 Canaries and X-Ray tracing .............................................................................................. 338 Running a canary on a VPC ............................................................................................. 339 Encrypting canary artifacts .............................................................................................. 340 Viewing canary statistics and details ................................................................................. 341 CloudWatch metrics published by canaries ......................................................................... 343 Edit or delete a canary .................................................................................................... 344 Start, stop, delete, or update runtime for multiple canaries .................................................. 346 Monitoring canary events with Amazon EventBridge ........................................................... 346 Perform launches and A/B experiments with CloudWatch Evidently .............................................. 349 IAM policies to use Evidently........................................................................................... 350 Create projects, features, launches, and experiments ........................................................... 351 Manage features, launches, and experiments ...................................................................... 365 Adding code to your application ....................................................................................... 368 Project data storage ....................................................................................................... 370 How Evidently calculates results ....................................................................................... 372 View launch results in the dashboard ................................................................................ 373 View experiment results in the dashboard ......................................................................... 374 How CloudWatch Evidently collects and stores data ............................................................ 374 Using service-linked roles ................................................................................................ 375 CloudWatch Evidently quotas ........................................................................................... 377 Tutorial: A/B testing with the Evidently sample application .................................................. 377 Use CloudWatch RUM ............................................................................................................. 384 IAM policies to use CloudWatch RUM ................................................................................ 386 Set up an application to use CloudWatch RUM ................................................................... 386 Configuring the CloudWatch RUM web client ..................................................................... 392 Use page groups ............................................................................................................ 394 Specify custom metadata ................................................................................................ 394 Send custom events ........................................................................................................ 398 Viewing the CloudWatch RUM dashboard .......................................................................... 400 CloudWatch metrics that you can collect with CloudWatch RUM ........................................... 401 Data protection and data privacy with CloudWatch RUM ..................................................... 407 vi Amazon CloudWatch User Guide Information collected by the CloudWatch RUM web client ................................................... 407 Manage your applications that use CloudWatch RUM .......................................................... 423 CloudWatch RUM quotas ................................................................................................. 424 Troubleshooting............................................................................................................. 425 Insights and operational visibility ..................................................................................................... 426 Using Container Insights.......................................................................................................... 426 Supported platforms....................................................................................................... 426 CloudWatch agent container image .................................................................................. 427 Supported Regions......................................................................................................... 427 Setting up Container Insights ........................................................................................... 428 Viewing Container Insights metrics................................................................................... 465 Metrics collected by Container Insights .............................................................................. 468 Performance log reference ............................................................................................... 476 Container Insights Prometheus metrics monitoring ............................................................. 496 Integration with Application Insights................................................................................. 575 See Amazon ECS lifecycle events within Container Insights .................................................. 575 Troubleshooting Container Insights ................................................................................... 576 Building your own CloudWatch agent Docker image ............................................................ 579 Deploying other CloudWatch agent features in your containers ............................................ 579 Using Lambda Insights............................................................................................................ 579 Getting started with Lambda Insights ............................................................................... 580 Viewing your Lambda Insights metrics .............................................................................. 599 Integration with Application Insights................................................................................. 599 Metrics collected by Lambda Insights ................................................................................ 599 Troubleshooting and known issues ................................................................................... 602 Example telemetry event ................................................................................................. 603 Using Contributor Insights to analyze high-cardinality data .......................................................... 604 Create a Contributor Insights rule ..................................................................................... 605 Contributor Insights rule syntax....................................................................................... 608 Example rules................................................................................................................ 611 Viewing Contributor Insights reports ................................................................................. 613 Graphing metrics generated by rules ................................................................................. 614 Using Contributor Insights built-in rules ............................................................................ 616 Detect common application problems with CloudWatch Application Insights .................................. 616 What is Amazon CloudWatch Application Insights? ............................................................. 617 How Application Insights works ........................................................................................ 623 Get started .................................................................................................................... 631 Work with component configurations ................................................................................ 650 Use CloudFormation templates ........................................................................................ 692 Tutorial: Set up monitoring for SAP HANA ......................................................................... 701 Tutorial: Set up monitoring for SAP NetWeaver .................................................................. 710 Tutorial: Set up monitoring for .NET and SQL ..................................................................... 723 View and troubleshoot Application Insights ....................................................................... 728 Supported logs and metrics ............................................................................................. 730 CloudWatch cross-account observability ............................................................................................ 792 Link monitoring accounts with source accounts .......................................................................... 793 Necessary permissions..................................................................................................... 794 Setup overview.............................................................................................................. 796 Step 1: Set up a monitoring account ................................................................................. 796 Step 2: (Optional) Download an AWS CloudFormation template or URL ................................. 797 Step 3: Link the source accounts ...................................................................................... 798 Manage monitoring accounts and source accounts ...................................................................... 799 Link more source accounts to an existing monitoring account ............................................... 799 Remove the link between a monitoring account and source account ...................................... 800 View information about a monitoring account .................................................................... 801 Collect metrics and logs with the CloudWatch agent ........................................................................... 802 Installing the CloudWatch agent ............................................................................................... 803 vii Amazon CloudWatch User Guide Installing the CloudWatch agent using the command line .................................................... 804 Install the CloudWatch agent using Systems Manager ......................................................... 818 Installing the CloudWatch agent on new instances using AWS CloudFormation ....................... 831 Verifying the signature of the CloudWatch agent package ................................................... 835 Create the CloudWatch agent configuration file ......................................................................... 842 Create the CloudWatch agent configuration file with the wizard ........................................... 842 Manually create or edit the CloudWatch agent configuration file .......................................... 847 Metrics collected by the CloudWatch agent ................................................................................ 895 Metrics collected by the CloudWatch agent on Windows Server instances ............................... 896 Metrics collected by the CloudWatch agent on Linux and macOS instances ............................. 896 Use the AWS OpenTelemetry Collector with the CloudWatch agent ............................................... 905 Generating OpenTelemetry traces ..................................................................................... 906 Common scenarios with the CloudWatch agent .......................................................................... 906 Running the CloudWatch agent as a different user .............................................................. 906 Adding custom dimensions to metrics collected by the CloudWatch agent .............................. 907 Multiple CloudWatch agent configuration files ................................................................... 908 Aggregating or rolling up metrics collected by the CloudWatch agent .................................... 910 Collecting high-resolution metrics with the CloudWatch agent ............................................. 910 Sending metrics and logs to a different account ................................................................. 911 Timestamp differences between the unified CloudWatch agent and the earlier CloudWatch Logs agent.................................................................................................................... 913 Troubleshooting the CloudWatch agent ..................................................................................... 913 CloudWatch agent command line parameters .................................................................... 913 Installing the CloudWatch agent using Run Command fails .................................................. 914 The CloudWatch agent won't start .................................................................................... 914 Verify that the CloudWatch agent is running ...................................................................... 914 The CloudWatch agent won't start, and the error mentions an Amazon EC2 Region ................. 915 The CloudWatch agent won't start on Windows Server ........................................................ 915 Unable to find credentials on Windows Server ................................................................... 916 Where are the metrics? ................................................................................................... 916 The CloudWatch agent takes a long time to run in a container or logs a hop limit error ............. 916 I updated my agent configuration but don’t see the new metrics or logs in the CloudWatch console.......................................................................................................................... 916 CloudWatch agent files and locations ................................................................................ 917 Finding information about CloudWatch agent versions ........................................................ 918 Logs generated by the CloudWatch agent ......................................................................... 918 Stopping and restarting the CloudWatch agent .................................................................. 919 Ingest high-cardinality logs to generate metrics with CloudWatch embedded metric format ..................... 920 Generating logs using the embedded metric format.................................................................... 920 Using the client libraries.................................................................................................. 921 Using the embedded metric format with AWS Distro for OpenTelemetry ................................ 921 Manually generating embedded metric format logs............................................................ 921 Viewing your metrics and logs in the console ............................................................................. 933 Services that publish CloudWatch metrics .......................................................................................... 935 AWS usage metrics......................................................................................................................... 942 Visualizing your service quotas and setting alarms ...................................................................... 942 AWS API usage metrics ........................................................................................................... 943 CloudWatch usage metrics ....................................................................................................... 949 CloudWatch tutorials...................................................................................................................... 950 Scenario: Monitor estimated charges ......................................................................................... 950 Step 1: Enable billing alerts ............................................................................................. 950 Step 2: Create a billing alarm .......................................................................................... 951 Step 3: Check the alarm status......................................................................................... 952 Step 4: Edit a billing alarm .............................................................................................. 952 Step 5: Delete a billing alarm.......................................................................................... 952 Scenario: Publish metrics ......................................................................................................... 953 Step 1: Define the data configuration ............................................................................... 953 viii Amazon CloudWatch User Guide Step 2: Add metrics to CloudWatch .................................................................................. 954 Step 3: Get statistics from CloudWatch ............................................................................. 954 Step 4: View graphs with the console ............................................................................... 955 Working with AWS SDKs ................................................................................................................. 956 Code examples............................................................................................................................... 957 Actions.................................................................................................................................. 957 Create an alarm that watches a metric .............................................................................. 958 Delete alarms................................................................................................................. 964 Describe alarm history .................................................................................................... 969 Describe alarms.............................................................................................................. 970 Describe alarms for a metric............................................................................................ 971 Disable alarm actions ...................................................................................................... 975 Enable alarm actions ....................................................................................................... 981 Get dashboard details ..................................................................................................... 987 Get metric statistics........................................................................................................ 988 List dashboards.............................................................................................................. 989 List metrics.................................................................................................................... 990 Put a set of data into a metric......................................................................................... 997 Put data into a metric..................................................................................................... 998 Scenarios............................................................................................................................. 1002 Get started with alarms................................................................................................. 1002 Manage Amazon CloudWatch metrics and alarms ............................................................. 1004 Security....................................................................................................................................... 1009 Data protection.................................................................................................................... 1009 Encryption in transit..................................................................................................... 1010 Identity and access management ............................................................................................ 1010 Authentication.............................................................................................................. 1010 Access control .............................................................................................................. 1011 CloudWatch dashboard permissions update ..................................................................... 1012 Overview of managing access......................................................................................... 1012 Using identity-based policies (IAM policies) ...................................................................... 1015 Using condition keys to limit access to CloudWatch namespaces ......................................... 1037 Using condition keys to limit Contributor Insights users' access to log groups ........................ 1038 Using condition keys to limit alarm actions ...................................................................... 1039 Using service-linked roles.............................................................................................. 1039 Using a service-linked role for Internet Monitor ................................................................ 1044 Using a service-linked role for CloudWatch RUM ............................................................... 1046 Using service-linked roles for Application Insights ............................................................. 1050 AWS managed policies for Application Insights ................................................................. 1057 Amazon CloudWatch permissions reference...................................................................... 1062 Compliance validation........................................................................................................... 1071 Resilience............................................................................................................................. 1072 Infrastructure security........................................................................................................... 1072 Network isolation......................................................................................................... 1072 Interface VPC endpoints ........................................................................................................ 1073 CloudWatch................................................................................................................. 1073 CloudWatch Synthetics.................................................................................................. 1074 Security considerations for Synthetics canaries ......................................................................... 1076 Use secure connections................................................................................................. 1076 Canary naming considerations ........................................................................................ 1076 Secrets and sensitive information in canary code .............................................................. 1076 Permissions considerations............................................................................................. 1077 Stack traces and exception messages .............................................................................. 1077 Scope your IAM roles narrowly ....................................................................................... 1077 Sensitive data redaction ................................................................................................ 1077 Logging API calls with AWS CloudTrail ............................................................................................ 1079 CloudWatch information in CloudTrail ..................................................................................... 1079 ix Amazon CloudWatch User Guide Example: CloudWatch log file entries .............................................................................. 1080 CloudWatch Internet Monitor in CloudTrail .............................................................................. 1082 Example: CloudWatch Internet Monitor log file entries ...................................................... 1082 CloudWatch Synthetics information in CloudTrail ...................................................................... 1083 Example: CloudWatch Synthetics log file entries ............................................................... 1084 Tagging your CloudWatch resources ................................................................................................ 1087 Supported resources in CloudWatch ........................................................................................ 1087 Managing tags...................................................................................................................... 1087 Tag naming and usage conventions ........................................................................................ 1088 Grafana integration....................................................................................................................... 1089 Cross-account cross-Region CloudWatch console ............................................................................... 1090 Enabling cross-account cross-Region functionality ..................................................................... 1090 (Optional) Integrate with AWS Organizations ........................................................................... 1093 Troubleshooting .................................................................................................................... 1093 Disabling and cleaning up after using cross-account .................................................................. 1094 Service quotas.............................................................................................................................. 1095 Document history......................................................................................................................... 1099 x

Description:
owned by Amazon are the property of their respective owners, who may or may not be affiliated with, . Sign Up for Amazon Web Services (AWS) .
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.