# CloudWatch code examples for the SDK for Ruby ## Overview Shows how to use the AWS SDK for Ruby to work with Amazon CloudWatch. *CloudWatch provides a reliable, scalable, and flexible monitoring solution that you can start using within minutes.* ## ⚠ Important * Running this code might result in charges to your AWS account. * Running the tests might result in charges to your AWS account. * We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). * This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). ## Code examples ### Prerequisites For prerequisites, see the [README](../../README.md#Prerequisites) in the `ruby` folder. ### Single actions Code excerpts that show you how to call individual service functions. * [Create a metric alarm](create_alarm.rb#L6) (`PutMetricAlarm`) * [Describe alarms for a metric](alarm_basics.rb#L8) (`DescribeAlarmsForMetric`) * [Disable alarm actions](alarm_actions.rb#L93) (`DisableAlarmActions`) * [List metrics](metrics_basics.rb#L69) (`ListMetrics`) * [Put data into a metric](metrics_basics.rb#L8) (`PutMetricData`) ## Run the examples ### Instructions The quickest way to interact with this example code is to invoke a [Scenario](#Scenarios) from your command line. For example, `ruby some_scenario.rb` will invoke `some_scenario.rb`. ### Tests ⚠ Running tests might result in charges to your AWS account. To find instructions for running these tests, see the [README](../../README.md#Tests) in the `ruby` folder. ## Contribute Code examples thrive on community contribution. To learn more about the contributing process, see [CONTRIBUTING.md](../../../CONTRIBUTING.md). ## Additional resources * [More Ruby CloudWatch code examples](https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/cw-examples.html) * [SDK for Ruby Developer Guide](https://aws.amazon.com/developer/language/ruby/) * [SDK for Ruby CloudWatch Module](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/CloudWatch.html) * [CloudWatch Developer Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html) * [CloudWatch API Reference](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/Welcome.html) --- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0