

# 使用 AWS SDK 的 CloudWatch 代码示例
<a name="service_code_examples"></a>

以下代码示例展示如何将 CloudWatch 与 AWS 软件开发工具包 (SDK) 结合使用。

*基本功能*是向您展示如何在服务中执行基本操作的代码示例。

*操作*是大型程序的代码摘录，必须在上下文中运行。您可以通过操作了解如何调用单个服务函数，还可以通过函数相关场景的上下文查看操作。

*场景*是向您展示如何通过在一个服务中调用多个函数或与其他 AWS 服务 服务结合来完成特定任务的代码示例。

有关 AWS SDK 开发人员指南和代码示例的完整列表，请参阅[将 CloudWatch 与 AWS SDK 结合使用](sdk-general-information-section.md)。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。

**Contents**
+ [基本功能](service_code_examples_basics.md)
  + [开始使用 CloudWatch](example_cloudwatch_Hello_section.md)
  + [了解基本功能](example_cloudwatch_GetStartedMetricsDashboardsAlarms_section.md)
  + [操作](service_code_examples_actions.md)
    + [`DeleteAlarms`](example_cloudwatch_DeleteAlarms_section.md)
    + [`DeleteAnomalyDetector`](example_cloudwatch_DeleteAnomalyDetector_section.md)
    + [`DeleteDashboards`](example_cloudwatch_DeleteDashboards_section.md)
    + [`DescribeAlarmHistory`](example_cloudwatch_DescribeAlarmHistory_section.md)
    + [`DescribeAlarms`](example_cloudwatch_DescribeAlarms_section.md)
    + [`DescribeAlarmsForMetric`](example_cloudwatch_DescribeAlarmsForMetric_section.md)
    + [`DescribeAnomalyDetectors`](example_cloudwatch_DescribeAnomalyDetectors_section.md)
    + [`DisableAlarmActions`](example_cloudwatch_DisableAlarmActions_section.md)
    + [`EnableAlarmActions`](example_cloudwatch_EnableAlarmActions_section.md)
    + [`GetDashboard`](example_cloudwatch_GetDashboard_section.md)
    + [`GetMetricData`](example_cloudwatch_GetMetricData_section.md)
    + [`GetMetricStatistics`](example_cloudwatch_GetMetricStatistics_section.md)
    + [`GetMetricWidgetImage`](example_cloudwatch_GetMetricWidgetImage_section.md)
    + [`ListDashboards`](example_cloudwatch_ListDashboards_section.md)
    + [`ListMetrics`](example_cloudwatch_ListMetrics_section.md)
    + [`PutAnomalyDetector`](example_cloudwatch_PutAnomalyDetector_section.md)
    + [`PutDashboard`](example_cloudwatch_PutDashboard_section.md)
    + [`PutMetricAlarm`](example_cloudwatch_PutMetricAlarm_section.md)
    + [`PutMetricData`](example_cloudwatch_PutMetricData_section.md)
+ [场景](service_code_examples_scenarios.md)
  + [将函数名称作为变量创建 CloudWatch 控制面板](example_cloudwatch_GettingStarted_031_section.md)
  + [开始使用告警](example_cloudwatch_Scenario_GettingStarted_section.md)
  + [管理指标和告警](example_cloudwatch_Usage_MetricsAlarms_section.md)
  + [监控 DynamoDB 性能](example_cross_MonitorDynamoDB_section.md)
  + [使用 FIS 在 EC2 实例上运行 CPU 压力测试](example_iam_GettingStarted_069_section.md)
  + [在 CloudWatch 控制面板中使用属性变量监控多个 Lambda 函数](example_iam_GettingStarted_032_section.md)