ebook img

Amazon CloudWatch PDF

389 Pages·2017·2.64 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

Amazon CloudWatch User Guide Amazon CloudWatch User Guide Amazon CloudWatch: User Guide Amazon CloudWatch User Guide Table of Contents What is Amazon CloudWatch?............................................................................................................. 1 Accessing CloudWatch................................................................................................................ 1 Related Amazon services ............................................................................................................. 1 How CloudWatch works .............................................................................................................. 2 Concepts................................................................................................................................... 3 Namespaces...................................................................................................................... 3 Metrics.............................................................................................................................. 3 Dimensions........................................................................................................................ 4 Resolution......................................................................................................................... 5 Statistics........................................................................................................................... 6 Units................................................................................................................................ 6 Periods............................................................................................................................. 6 Aggregation....................................................................................................................... 7 Percentiles......................................................................................................................... 7 Alarms.............................................................................................................................. 8 Billing and cost......................................................................................................................... 9 Analyze CloudWatch cost and usage data with Cost Explorer .................................................. 9 Analyze CloudWatch cost and usage data with Amazon 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 (Amazon) ................................................................................ 24 Sign in to the Amazon CloudWatch console ................................................................................. 24 Set up the Amazon CLI ............................................................................................................. 24 Getting started ................................................................................................................................ 26 See key metrics from all Amazon 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 Amazon Web Services 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 ......................................................... 101 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 Amazon Web Services Management Console ........... 182 Setting up an SNS topic using the Amazon 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 Amazon Web Services Management Console .............. 200 Setting up a CPU usage alarm using the Amazon CLI .......................................................... 201 Creating a load balancer latency alarm ..................................................................................... 201 Setting up a latency alarm using the Amazon Web Services Management Console ................... 202 Setting up a latency alarm using the Amazon CLI ............................................................... 202 Creating a storage throughput alarm ........................................................................................ 203 Setting up a storage throughput alarm using the Amazon Web Services Management Console ... 203 Setting up a storage throughput alarm using the Amazon 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 Amazon 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 ........................................................................................ 259 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 Contributor Insights to analyze high-cardinality data .......................................................... 579 Create a Contributor Insights rule ..................................................................................... 580 Contributor Insights rule syntax....................................................................................... 583 Example rules................................................................................................................ 586 Viewing Contributor Insights reports ................................................................................. 589 Graphing metrics generated by rules ................................................................................. 590 Using Contributor Insights built-in rules ............................................................................ 592 Detect common application problems with CloudWatch Application Insights .................................. 592 What is Amazon CloudWatch Application Insights? ............................................................. 593 How Application Insights works ........................................................................................ 599 Get started .................................................................................................................... 607 Work with component configurations ................................................................................ 626 Use CloudFormation templates ........................................................................................ 668 Tutorial: Set up monitoring for SAP HANA ......................................................................... 677 Tutorial: Set up monitoring for .NET and SQL ..................................................................... 686 View and troubleshoot Application Insights ....................................................................... 691 Supported logs and metrics ............................................................................................. 693 CloudWatch cross-account observability ............................................................................................ 755 Link monitoring accounts with source accounts .......................................................................... 756 Necessary permissions..................................................................................................... 757 Setup overview.............................................................................................................. 759 Step 1: Set up a monitoring account ................................................................................. 759 Step 2: (Optional) Download an Amazon CloudFormation template or URL ............................. 760 Step 3: Link the source accounts ...................................................................................... 761 Manage monitoring accounts and source accounts ...................................................................... 762 Link more source accounts to an existing monitoring account ............................................... 763 Remove the link between a monitoring account and source account ...................................... 763 View information about a monitoring account .................................................................... 764 Collect metrics and logs with the CloudWatch agent ........................................................................... 765 Installing the CloudWatch agent ............................................................................................... 766 Installing the CloudWatch agent using the command line .................................................... 767 Install the CloudWatch agent using Systems Manager ......................................................... 776 Verifying the signature of the CloudWatch agent package ................................................... 789 Create the CloudWatch agent configuration file ......................................................................... 790 Create the CloudWatch agent configuration file with the wizard ........................................... 790 Manually create or edit the CloudWatch agent configuration file .......................................... 795 Metrics collected by the CloudWatch agent ................................................................................ 843 Metrics collected by the CloudWatch agent on Windows Server instances ............................... 844 vii Amazon CloudWatch User Guide Metrics collected by the CloudWatch agent on Linux and macOS instances ............................. 844 Use the Amazon OpenTelemetry Collector with the CloudWatch agent .......................................... 853 Generating OpenTelemetry traces ..................................................................................... 854 Common scenarios with the CloudWatch agent .......................................................................... 854 Running the CloudWatch agent as a different user .............................................................. 854 Adding custom dimensions to metrics collected by the CloudWatch agent .............................. 855 Multiple CloudWatch agent configuration files ................................................................... 856 Aggregating or rolling up metrics collected by the CloudWatch agent .................................... 858 Collecting high-resolution metrics with the CloudWatch agent ............................................. 858 Sending metrics and logs to a different account ................................................................. 859 Timestamp differences between the unified CloudWatch agent and the earlier CloudWatch Logs agent.................................................................................................................... 861 Troubleshooting the CloudWatch agent ..................................................................................... 861 CloudWatch agent command line parameters .................................................................... 861 Installing the CloudWatch agent using Run Command fails .................................................. 862 The CloudWatch agent won't start .................................................................................... 862 Verify that the CloudWatch agent is running ...................................................................... 862 The CloudWatch agent won't start, and the error mentions an Amazon EC2 Region ................. 863 The CloudWatch agent won't start on Windows Server ........................................................ 863 Unable to find credentials on Windows Server ................................................................... 864 Where are the metrics? ................................................................................................... 864 The CloudWatch agent takes a long time to run in a container or logs a hop limit error ............. 864 I updated my agent configuration but don’t see the new metrics or logs in the CloudWatch console.......................................................................................................................... 864 CloudWatch agent files and locations ................................................................................ 865 Logs generated by the CloudWatch agent ......................................................................... 866 Stopping and restarting the CloudWatch agent .................................................................. 866 Ingest high-cardinality logs to generate metrics with CloudWatch embedded metric format ..................... 868 Generating logs using the embedded metric format.................................................................... 868 Using the client libraries.................................................................................................. 869 Using the embedded metric format with Amazon Distro for OpenTelemetry ........................... 869 Manually generating embedded metric format logs............................................................ 869 Viewing your metrics and logs in the console ............................................................................. 881 Services that publish CloudWatch metrics .......................................................................................... 883 Amazon usage metrics .................................................................................................................... 890 Visualizing your service quotas and setting alarms ...................................................................... 890 Amazon API usage metrics ....................................................................................................... 891 CloudWatch usage metrics ....................................................................................................... 897 CloudWatch tutorials...................................................................................................................... 898 Scenario: Monitor estimated charges ......................................................................................... 898 Step 1: Enable billing alerts ............................................................................................. 898 Step 2: Create a billing alarm .......................................................................................... 899 Step 3: Check the alarm status......................................................................................... 900 Step 4: Edit a billing alarm .............................................................................................. 900 Step 5: Delete a billing alarm.......................................................................................... 900 Scenario: Publish metrics ......................................................................................................... 901 Step 1: Define the data configuration ............................................................................... 901 Step 2: Add metrics to CloudWatch .................................................................................. 902 Step 3: Get statistics from CloudWatch ............................................................................. 902 Step 4: View graphs with the console ............................................................................... 903 Working with Amazon SDKs ............................................................................................................. 904 Code examples............................................................................................................................... 905 Actions.................................................................................................................................. 905 Create an alarm that watches a metric .............................................................................. 906 Delete alarms................................................................................................................. 912 Describe alarm history .................................................................................................... 917 Describe alarms.............................................................................................................. 918 viii Amazon CloudWatch User Guide Describe alarms for a metric............................................................................................ 919 Disable alarm actions ...................................................................................................... 923 Enable alarm actions ....................................................................................................... 929 Get dashboard details ..................................................................................................... 935 Get metric statistics........................................................................................................ 936 List dashboards.............................................................................................................. 937 List metrics.................................................................................................................... 938 Put a set of data into a metric......................................................................................... 945 Put data into a metric..................................................................................................... 946 Scenarios............................................................................................................................... 950 Get started with alarms .................................................................................................. 950 Manage Amazon CloudWatch metrics and alarms ............................................................... 952 Security......................................................................................................................................... 957 Data protection...................................................................................................................... 957 Encryption in transit ....................................................................................................... 958 Identity and access management .............................................................................................. 958 Authentication............................................................................................................... 958 Access control................................................................................................................ 959 CloudWatch dashboard permissions update ....................................................................... 960 Overview of managing access .......................................................................................... 960 Using identity-based policies (IAM policies) ........................................................................ 963 Using condition keys to limit access to CloudWatch namespaces ........................................... 985 Using condition keys to limit Contributor Insights users' access to log groups .......................... 986 Using condition keys to limit alarm actions ........................................................................ 987 Using service-linked roles ................................................................................................ 987 Using a service-linked role for Internet Monitor .................................................................. 992 Using a service-linked role for CloudWatch RUM ................................................................. 994 Using service-linked roles for Application Insights ............................................................... 998 Amazon managed policies for Application Insights............................................................ 1005 Amazon CloudWatch permissions reference...................................................................... 1011 Compliance validation........................................................................................................... 1019 Resilience............................................................................................................................. 1020 Infrastructure security........................................................................................................... 1020 Network isolation......................................................................................................... 1020 Interface VPC endpoints ........................................................................................................ 1021 CloudWatch................................................................................................................. 1021 CloudWatch Synthetics.................................................................................................. 1022 Security considerations for Synthetics canaries ......................................................................... 1024 Use secure connections................................................................................................. 1024 Canary naming considerations ........................................................................................ 1024 Secrets and sensitive information in canary code .............................................................. 1024 Permissions considerations............................................................................................. 1025 Stack traces and exception messages .............................................................................. 1025 Scope your IAM roles narrowly ....................................................................................... 1025 Sensitive data redaction ................................................................................................ 1025 Logging API calls with Amazon CloudTrail ....................................................................................... 1027 CloudWatch information in CloudTrail ..................................................................................... 1027 Example: CloudWatch log file entries .............................................................................. 1028 CloudWatch Internet Monitor in CloudTrail .............................................................................. 1030 Example: CloudWatch Internet Monitor log file entries ...................................................... 1030 CloudWatch Synthetics information in CloudTrail ...................................................................... 1031 Example: CloudWatch Synthetics log file entries ............................................................... 1032 Tagging your CloudWatch resources ................................................................................................ 1035 Supported resources in CloudWatch ........................................................................................ 1035 Managing tags...................................................................................................................... 1035 Tag naming and usage conventions ........................................................................................ 1036 Grafana integration....................................................................................................................... 1037 ix Amazon CloudWatch User Guide Cross-account cross-Region CloudWatch console ............................................................................... 1038 Enabling cross-account cross-Region functionality ..................................................................... 1038 (Optional) Integrate with Amazon Organizations ....................................................................... 1041 Troubleshooting .................................................................................................................... 1041 Disabling and cleaning up after using cross-account .................................................................. 1042 Service quotas.............................................................................................................................. 1044 Document history......................................................................................................................... 1048 x

Description:
Dimensions for Amazon CloudSearch Metrics . CloudSearch Domain with Amazon CloudWatch in the Amazon CloudSearch Developer Guide.
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.