

# Actions
<a name="API_Operations"></a>

The following actions are supported:
+  [DeleteAlarmMuteRule](API_DeleteAlarmMuteRule.md) 
+  [DeleteAlarms](API_DeleteAlarms.md) 
+  [DeleteAnomalyDetector](API_DeleteAnomalyDetector.md) 
+  [DeleteDashboards](API_DeleteDashboards.md) 
+  [DeleteInsightRules](API_DeleteInsightRules.md) 
+  [DeleteMetricStream](API_DeleteMetricStream.md) 
+  [DescribeAlarmContributors](API_DescribeAlarmContributors.md) 
+  [DescribeAlarmHistory](API_DescribeAlarmHistory.md) 
+  [DescribeAlarms](API_DescribeAlarms.md) 
+  [DescribeAlarmsForMetric](API_DescribeAlarmsForMetric.md) 
+  [DescribeAnomalyDetectors](API_DescribeAnomalyDetectors.md) 
+  [DescribeInsightRules](API_DescribeInsightRules.md) 
+  [DisableAlarmActions](API_DisableAlarmActions.md) 
+  [DisableInsightRules](API_DisableInsightRules.md) 
+  [EnableAlarmActions](API_EnableAlarmActions.md) 
+  [EnableInsightRules](API_EnableInsightRules.md) 
+  [GetAlarmMuteRule](API_GetAlarmMuteRule.md) 
+  [GetDashboard](API_GetDashboard.md) 
+  [GetInsightRuleReport](API_GetInsightRuleReport.md) 
+  [GetMetricData](API_GetMetricData.md) 
+  [GetMetricStatistics](API_GetMetricStatistics.md) 
+  [GetMetricStream](API_GetMetricStream.md) 
+  [GetMetricWidgetImage](API_GetMetricWidgetImage.md) 
+  [GetOTelEnrichment](API_GetOTelEnrichment.md) 
+  [ListAlarmMuteRules](API_ListAlarmMuteRules.md) 
+  [ListDashboards](API_ListDashboards.md) 
+  [ListManagedInsightRules](API_ListManagedInsightRules.md) 
+  [ListMetrics](API_ListMetrics.md) 
+  [ListMetricStreams](API_ListMetricStreams.md) 
+  [ListTagsForResource](API_ListTagsForResource.md) 
+  [PutAlarmMuteRule](API_PutAlarmMuteRule.md) 
+  [PutAnomalyDetector](API_PutAnomalyDetector.md) 
+  [PutCompositeAlarm](API_PutCompositeAlarm.md) 
+  [PutDashboard](API_PutDashboard.md) 
+  [PutInsightRule](API_PutInsightRule.md) 
+  [PutManagedInsightRules](API_PutManagedInsightRules.md) 
+  [PutMetricAlarm](API_PutMetricAlarm.md) 
+  [PutMetricData](API_PutMetricData.md) 
+  [PutMetricStream](API_PutMetricStream.md) 
+  [SetAlarmState](API_SetAlarmState.md) 
+  [StartMetricStreams](API_StartMetricStreams.md) 
+  [StartOTelEnrichment](API_StartOTelEnrichment.md) 
+  [StopMetricStreams](API_StopMetricStreams.md) 
+  [StopOTelEnrichment](API_StopOTelEnrichment.md) 
+  [TagResource](API_TagResource.md) 
+  [UntagResource](API_UntagResource.md) 

# DeleteAlarmMuteRule
<a name="API_DeleteAlarmMuteRule"></a>

Deletes a specific alarm mute rule.

When you delete a mute rule, any alarms that are currently being muted by that rule are immediately unmuted. If those alarms are in an ALARM state, their configured actions will trigger.

This operation is idempotent. If you delete a mute rule that does not exist, the operation succeeds without returning an error.

 **Permissions** 

To delete a mute rule, you need the `cloudwatch:DeleteAlarmMuteRule` permission on the alarm mute rule resource.

## Request Parameters
<a name="API_DeleteAlarmMuteRule_RequestParameters"></a>

 ** AlarmMuteRuleName **   
The name of the alarm mute rule to delete.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

## Errors
<a name="API_DeleteAlarmMuteRule_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

## Examples
<a name="API_DeleteAlarmMuteRule_Examples"></a>

### Delete a mute rule
<a name="API_DeleteAlarmMuteRule_Example_1"></a>

Delete a specific alarm mute rule. This operation does not return any output on success.

#### Sample Request
<a name="API_DeleteAlarmMuteRule_Example_1_Request"></a>

```
aws cloudwatch delete-alarm-mute-rule \
	--alarm-mute-rule-name "DailyMaintenanceWindow"
```

## See Also
<a name="API_DeleteAlarmMuteRule_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DeleteAlarmMuteRule) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DeleteAlarmMuteRule) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DeleteAlarmMuteRule) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DeleteAlarmMuteRule) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DeleteAlarmMuteRule) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DeleteAlarmMuteRule) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DeleteAlarmMuteRule) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DeleteAlarmMuteRule) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DeleteAlarmMuteRule) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DeleteAlarmMuteRule) 

# DeleteAlarms
<a name="API_DeleteAlarms"></a>

Deletes the specified alarms. You can delete up to 100 alarms in one operation. However, this total can include no more than one composite alarm. For example, you could delete 99 metric alarms and one composite alarms with one operation, but you can't delete two composite alarms with one operation.

 If you specify any incorrect alarm names, the alarms you specify with correct names are still deleted. Other syntax errors might result in no alarms being deleted. To confirm that alarms were deleted successfully, you can use the [DescribeAlarms](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html) operation after using `DeleteAlarms`.

**Note**  
It is possible to create a loop or cycle of composite alarms, where composite alarm A depends on composite alarm B, and composite alarm B also depends on composite alarm A. In this scenario, you can't delete any composite alarm that is part of the cycle because there is always still a composite alarm that depends on that alarm that you want to delete.  
To get out of such a situation, you must break the cycle by changing the rule of one of the composite alarms in the cycle to remove a dependency that creates the cycle. The simplest change to make to break a cycle is to change the `AlarmRule` of one of the alarms to `false`.   
Additionally, the evaluation of composite alarms stops if CloudWatch detects a cycle in the evaluation path. 

## Request Parameters
<a name="API_DeleteAlarms_RequestParameters"></a>

 ** AlarmNames **   
The alarms to be deleted. Do not enclose the alarm names in quote marks.  
Type: Array of strings  
Array Members: Maximum number of 100 items.  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

## Errors
<a name="API_DeleteAlarms_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ResourceNotFound **   
The named resource does not exist.    
 ** message **   

HTTP Status Code: 404

## See Also
<a name="API_DeleteAlarms_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DeleteAlarms) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DeleteAlarms) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DeleteAlarms) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DeleteAlarms) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DeleteAlarms) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DeleteAlarms) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DeleteAlarms) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DeleteAlarms) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DeleteAlarms) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DeleteAlarms) 

# DeleteAnomalyDetector
<a name="API_DeleteAnomalyDetector"></a>

 Deletes the specified anomaly detection model from your account. For more information about how to delete an anomaly detection model, see [Deleting an anomaly detection model](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Create_Anomaly_Detection_Alarm.html#Delete_Anomaly_Detection_Model) in the *CloudWatch User Guide*. 

## Request Parameters
<a name="API_DeleteAnomalyDetector_RequestParameters"></a>

 ** Dimensions **   
 *This parameter has been deprecated.*   
The metric dimensions associated with the anomaly detection model to delete.  
Type: Array of [Dimension](API_Dimension.md) objects  
Array Members: Maximum number of 30 items.  
Required: No

 ** MetricMathAnomalyDetector **   
The metric math anomaly detector to be deleted.  
When using `MetricMathAnomalyDetector`, you cannot include following parameters in the same operation:  
+  `Dimensions`,
+  `MetricName` 
+  `Namespace` 
+  `Stat` 
+ the `SingleMetricAnomalyDetector` parameters of `DeleteAnomalyDetectorInput` 
Instead, specify the metric math anomaly detector attributes as part of the `MetricMathAnomalyDetector` property.  
Type: [MetricMathAnomalyDetector](API_MetricMathAnomalyDetector.md) object  
Required: No

 ** MetricName **   
 *This parameter has been deprecated.*   
The metric name associated with the anomaly detection model to delete.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** Namespace **   
 *This parameter has been deprecated.*   
The namespace associated with the anomaly detection model to delete.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Pattern: `[^:].*`   
Required: No

 ** SingleMetricAnomalyDetector **   
A single metric anomaly detector to be deleted.  
When using `SingleMetricAnomalyDetector`, you cannot include the following parameters in the same operation:  
+  `Dimensions`,
+  `MetricName` 
+  `Namespace` 
+  `Stat` 
+ the `MetricMathAnomalyDetector` parameters of `DeleteAnomalyDetectorInput` 
Instead, specify the single metric anomaly detector attributes as part of the `SingleMetricAnomalyDetector` property.  
Type: [SingleMetricAnomalyDetector](API_SingleMetricAnomalyDetector.md) object  
Required: No

 ** Stat **   
 *This parameter has been deprecated.*   
The statistic associated with the anomaly detection model to delete.  
Type: String  
Length Constraints: Maximum length of 50.  
Pattern: `(SampleCount|Average|Sum|Minimum|Maximum|IQM|(p|tc|tm|ts|wm)(\d{1,2}(\.\d{0,10})?|100)|[ou]\d+(\.\d*)?)(_E|_L|_H)?|(TM|TC|TS|WM)\(((((\d{1,2})(\.\d{0,10})?|100(\.0{0,10})?)%)?:((\d{1,2})(\.\d{0,10})?|100(\.0{0,10})?)%|((\d{1,2})(\.\d{0,10})?|100(\.0{0,10})?)%:(((\d{1,2})(\.\d{0,10})?|100(\.0{0,10})?)%)?)\)|(TM|TC|TS|WM|PR)\(((\d+(\.\d{0,10})?|(\d+(\.\d{0,10})?[Ee][+-]?\d+)):((\d+(\.\d{0,10})?|(\d+(\.\d{0,10})?[Ee][+-]?\d+)))?|((\d+(\.\d{0,10})?|(\d+(\.\d{0,10})?[Ee][+-]?\d+)))?:(\d+(\.\d{0,10})?|(\d+(\.\d{0,10})?[Ee][+-]?\d+)))\)`   
Required: No

## Errors
<a name="API_DeleteAnomalyDetector_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterCombination **   
Parameters were used together that cannot be used together.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFoundException **   
The named resource does not exist.  
HTTP Status Code: 404

## See Also
<a name="API_DeleteAnomalyDetector_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DeleteAnomalyDetector) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DeleteAnomalyDetector) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DeleteAnomalyDetector) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DeleteAnomalyDetector) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DeleteAnomalyDetector) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DeleteAnomalyDetector) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DeleteAnomalyDetector) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DeleteAnomalyDetector) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DeleteAnomalyDetector) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DeleteAnomalyDetector) 

# DeleteDashboards
<a name="API_DeleteDashboards"></a>

Deletes all dashboards that you specify. You can specify up to 100 dashboards to delete. If there is an error during this call, no dashboards are deleted.

## Request Parameters
<a name="API_DeleteDashboards_RequestParameters"></a>

 ** DashboardNames **   
The dashboards to be deleted. This parameter is required.  
Type: Array of strings  
Required: Yes

## Errors
<a name="API_DeleteDashboards_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ConflictException **   
This operation attempted to create a resource that already exists.  
HTTP Status Code: 409

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFound **   
The specified dashboard does not exist.  
HTTP Status Code: 404

## See Also
<a name="API_DeleteDashboards_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DeleteDashboards) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DeleteDashboards) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DeleteDashboards) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DeleteDashboards) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DeleteDashboards) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DeleteDashboards) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DeleteDashboards) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DeleteDashboards) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DeleteDashboards) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DeleteDashboards) 

# DeleteInsightRules
<a name="API_DeleteInsightRules"></a>

Permanently deletes the specified Contributor Insights rules.

If you create a rule, delete it, and then re-create it with the same name, historical data from the first time the rule was created might not be available.

## Request Parameters
<a name="API_DeleteInsightRules_RequestParameters"></a>

 ** RuleNames **   
An array of the rule names to delete. If you need to find out the names of your rules, use [DescribeInsightRules](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_DescribeInsightRules.html).  
Type: Array of strings  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[\x20-\x7E]+`   
Required: Yes

## Response Elements
<a name="API_DeleteInsightRules_ResponseElements"></a>

The following element is returned by the service.

 ** Failures **   
An array listing the rules that could not be deleted. You cannot delete built-in rules.  
Type: Array of [PartialFailure](API_PartialFailure.md) objects

## Errors
<a name="API_DeleteInsightRules_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_DeleteInsightRules_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DeleteInsightRules) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DeleteInsightRules) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DeleteInsightRules) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DeleteInsightRules) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DeleteInsightRules) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DeleteInsightRules) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DeleteInsightRules) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DeleteInsightRules) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DeleteInsightRules) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DeleteInsightRules) 

# DeleteMetricStream
<a name="API_DeleteMetricStream"></a>

Permanently deletes the metric stream that you specify.

## Request Parameters
<a name="API_DeleteMetricStream_RequestParameters"></a>

 ** Name **   
The name of the metric stream to delete.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

## Errors
<a name="API_DeleteMetricStream_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_DeleteMetricStream_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DeleteMetricStream) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DeleteMetricStream) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DeleteMetricStream) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DeleteMetricStream) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DeleteMetricStream) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DeleteMetricStream) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DeleteMetricStream) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DeleteMetricStream) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DeleteMetricStream) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DeleteMetricStream) 

# DescribeAlarmContributors
<a name="API_DescribeAlarmContributors"></a>

Returns the information of the current alarm contributors that are in `ALARM` state. This operation returns details about the individual time series that contribute to the alarm's state.

## Request Parameters
<a name="API_DescribeAlarmContributors_RequestParameters"></a>

 ** AlarmName **   
The name of the alarm for which to retrieve contributor information.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

 ** NextToken **   
The token returned by a previous call to indicate that there is more data available.  
Type: String  
Required: No

## Response Elements
<a name="API_DescribeAlarmContributors_ResponseElements"></a>

The following elements are returned by the service.

 ** AlarmContributors **   
A list of alarm contributors that provide details about the individual time series contributing to the alarm's state.  
Type: Array of [AlarmContributor](API_AlarmContributor.md) objects

 ** NextToken **   
The token that marks the start of the next batch of returned results.  
Type: String

## Errors
<a name="API_DescribeAlarmContributors_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidNextToken **   
The next token specified is invalid.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFoundException **   
The named resource does not exist.  
HTTP Status Code: 404

## See Also
<a name="API_DescribeAlarmContributors_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DescribeAlarmContributors) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DescribeAlarmContributors) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DescribeAlarmContributors) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DescribeAlarmContributors) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DescribeAlarmContributors) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DescribeAlarmContributors) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DescribeAlarmContributors) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DescribeAlarmContributors) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DescribeAlarmContributors) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DescribeAlarmContributors) 

# DescribeAlarmHistory
<a name="API_DescribeAlarmHistory"></a>

Retrieves the history for the specified alarm. You can filter the results by date range or item type. If an alarm name is not specified, the histories for either all metric alarms or all composite alarms are returned.

CloudWatch retains the history of an alarm even if you delete the alarm.

To use this operation and return information about a composite alarm, you must be signed on with the `cloudwatch:DescribeAlarmHistory` permission that is scoped to `*`. You can't return information about composite alarms if your `cloudwatch:DescribeAlarmHistory` permission has a narrower scope.

## Request Parameters
<a name="API_DescribeAlarmHistory_RequestParameters"></a>

 ** AlarmContributorId **   
The unique identifier of a specific alarm contributor to filter the alarm history results.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 16.  
Required: No

 ** AlarmName **   
The name of the alarm.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** AlarmTypes **   
Use this parameter to specify whether you want the operation to return metric alarms or composite alarms. If you omit this parameter, only metric alarms are returned.  
Type: Array of strings  
Valid Values: `CompositeAlarm | MetricAlarm`   
Required: No

 ** EndDate **   
The ending date to retrieve alarm history.  
Type: Timestamp  
Required: No

 ** HistoryItemType **   
The type of alarm histories to retrieve.  
Type: String  
Valid Values: `ConfigurationUpdate | StateUpdate | Action | AlarmContributorStateUpdate | AlarmContributorAction`   
Required: No

 ** MaxRecords **   
The maximum number of alarm history records to retrieve.  
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 100.  
Required: No

 ** NextToken **   
The token returned by a previous call to indicate that there is more data available.  
Type: String  
Required: No

 ** ScanBy **   
Specified whether to return the newest or oldest alarm history first. Specify `TimestampDescending` to have the newest event history returned first, and specify `TimestampAscending` to have the oldest history returned first.  
Type: String  
Valid Values: `TimestampDescending | TimestampAscending`   
Required: No

 ** StartDate **   
The starting date to retrieve alarm history.  
Type: Timestamp  
Required: No

## Response Elements
<a name="API_DescribeAlarmHistory_ResponseElements"></a>

The following elements are returned by the service.

 ** AlarmHistoryItems **   
The alarm histories, in JSON format.  
Type: Array of [AlarmHistoryItem](API_AlarmHistoryItem.md) objects

 ** NextToken **   
The token that marks the start of the next batch of returned results.  
Type: String

## Errors
<a name="API_DescribeAlarmHistory_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidNextToken **   
The next token specified is invalid.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_DescribeAlarmHistory_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DescribeAlarmHistory) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DescribeAlarmHistory) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DescribeAlarmHistory) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DescribeAlarmHistory) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DescribeAlarmHistory) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DescribeAlarmHistory) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DescribeAlarmHistory) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DescribeAlarmHistory) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DescribeAlarmHistory) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DescribeAlarmHistory) 

# DescribeAlarms
<a name="API_DescribeAlarms"></a>

Retrieves the specified alarms. You can filter the results by specifying a prefix for the alarm name, the alarm state, or a prefix for any action.

To use this operation and return information about composite alarms, you must be signed on with the `cloudwatch:DescribeAlarms` permission that is scoped to `*`. You can't return information about composite alarms if your `cloudwatch:DescribeAlarms` permission has a narrower scope.

## Request Parameters
<a name="API_DescribeAlarms_RequestParameters"></a>

 ** ActionPrefix **   
Use this parameter to filter the results of the operation to only those alarms that use a certain alarm action. For example, you could specify the ARN of an SNS topic to find all alarms that send notifications to that topic.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: No

 ** AlarmNamePrefix **   
An alarm name prefix. If you specify this parameter, you receive information about all alarms that have names that start with this prefix.  
If this parameter is specified, you cannot specify `AlarmNames`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** AlarmNames **   
The names of the alarms to retrieve information about.  
Type: Array of strings  
Array Members: Maximum number of 100 items.  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** AlarmTypes **   
Use this parameter to specify whether you want the operation to return metric alarms or composite alarms. If you omit this parameter, only metric alarms are returned, even if composite alarms exist in the account.  
For example, if you omit this parameter or specify `MetricAlarms`, the operation returns only a list of metric alarms. It does not return any composite alarms, even if composite alarms exist in the account.  
If you specify `CompositeAlarms`, the operation returns only a list of composite alarms, and does not return any metric alarms.  
Type: Array of strings  
Valid Values: `CompositeAlarm | MetricAlarm`   
Required: No

 ** ChildrenOfAlarmName **   
If you use this parameter and specify the name of a composite alarm, the operation returns information about the "children" alarms of the alarm you specify. These are the metric alarms and composite alarms referenced in the `AlarmRule` field of the composite alarm that you specify in `ChildrenOfAlarmName`. Information about the composite alarm that you name in `ChildrenOfAlarmName` is not returned.  
If you specify `ChildrenOfAlarmName`, you cannot specify any other parameters in the request except for `MaxRecords` and `NextToken`. If you do so, you receive a validation error.  
Only the `Alarm Name`, `ARN`, `StateValue` (OK/ALARM/INSUFFICIENT\$1DATA), and `StateUpdatedTimestamp` information are returned by this operation when you use this parameter. To get complete information about these alarms, perform another `DescribeAlarms` operation and specify the parent alarm names in the `AlarmNames` parameter.
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** MaxRecords **   
The maximum number of alarm descriptions to retrieve.  
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 100.  
Required: No

 ** NextToken **   
The token returned by a previous call to indicate that there is more data available.  
Type: String  
Required: No

 ** ParentsOfAlarmName **   
If you use this parameter and specify the name of a metric or composite alarm, the operation returns information about the "parent" alarms of the alarm you specify. These are the composite alarms that have `AlarmRule` parameters that reference the alarm named in `ParentsOfAlarmName`. Information about the alarm that you specify in `ParentsOfAlarmName` is not returned.  
If you specify `ParentsOfAlarmName`, you cannot specify any other parameters in the request except for `MaxRecords` and `NextToken`. If you do so, you receive a validation error.  
Only the Alarm Name and ARN are returned by this operation when you use this parameter. To get complete information about these alarms, perform another `DescribeAlarms` operation and specify the parent alarm names in the `AlarmNames` parameter.
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** StateValue **   
Specify this parameter to receive information only about alarms that are currently in the state that you specify.  
Type: String  
Valid Values: `OK | ALARM | INSUFFICIENT_DATA`   
Required: No

## Response Elements
<a name="API_DescribeAlarms_ResponseElements"></a>

The following elements are returned by the service.

 ** CompositeAlarms **   
The information about any composite alarms returned by the operation.  
Type: Array of [CompositeAlarm](API_CompositeAlarm.md) objects

 ** MetricAlarms **   
The information about any metric alarms returned by the operation.  
Type: Array of [MetricAlarm](API_MetricAlarm.md) objects

 ** NextToken **   
The token that marks the start of the next batch of returned results.  
Type: String

## Errors
<a name="API_DescribeAlarms_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidNextToken **   
The next token specified is invalid.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_DescribeAlarms_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DescribeAlarms) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DescribeAlarms) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DescribeAlarms) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DescribeAlarms) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DescribeAlarms) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DescribeAlarms) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DescribeAlarms) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DescribeAlarms) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DescribeAlarms) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DescribeAlarms) 

# DescribeAlarmsForMetric
<a name="API_DescribeAlarmsForMetric"></a>

Retrieves the alarms for the specified metric. To filter the results, specify a statistic, period, or unit.

This operation retrieves only standard alarms that are based on the specified metric. It does not return alarms based on math expressions that use the specified metric, or composite alarms that use the specified metric.

## Request Parameters
<a name="API_DescribeAlarmsForMetric_RequestParameters"></a>

 ** Dimensions **   
The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them in order for the call to succeed.  
Type: Array of [Dimension](API_Dimension.md) objects  
Array Members: Maximum number of 30 items.  
Required: No

 ** ExtendedStatistic **   
The percentile statistic for the metric. Specify a value between p0.0 and p100.  
Type: String  
Required: No

 ** MetricName **   
The name of the metric.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

 ** Namespace **   
The namespace of the metric.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Pattern: `[^:].*`   
Required: Yes

 ** Period **   
The period, in seconds, over which the statistic is applied.  
Type: Integer  
Valid Range: Minimum value of 1.  
Required: No

 ** Statistic **   
The statistic for the metric, other than percentiles. For percentile statistics, use `ExtendedStatistics`.  
Type: String  
Valid Values: `SampleCount | Average | Sum | Minimum | Maximum`   
Required: No

 ** Unit **   
The unit for the metric.  
Type: String  
Valid Values: `Seconds | Microseconds | Milliseconds | Bytes | Kilobytes | Megabytes | Gigabytes | Terabytes | Bits | Kilobits | Megabits | Gigabits | Terabits | Percent | Count | Bytes/Second | Kilobytes/Second | Megabytes/Second | Gigabytes/Second | Terabytes/Second | Bits/Second | Kilobits/Second | Megabits/Second | Gigabits/Second | Terabits/Second | Count/Second | None`   
Required: No

## Response Elements
<a name="API_DescribeAlarmsForMetric_ResponseElements"></a>

The following element is returned by the service.

 ** MetricAlarms **   
The information for each alarm with the specified metric.  
Type: Array of [MetricAlarm](API_MetricAlarm.md) objects

## Errors
<a name="API_DescribeAlarmsForMetric_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

## See Also
<a name="API_DescribeAlarmsForMetric_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DescribeAlarmsForMetric) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DescribeAlarmsForMetric) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DescribeAlarmsForMetric) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DescribeAlarmsForMetric) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DescribeAlarmsForMetric) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DescribeAlarmsForMetric) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DescribeAlarmsForMetric) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DescribeAlarmsForMetric) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DescribeAlarmsForMetric) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DescribeAlarmsForMetric) 

# DescribeAnomalyDetectors
<a name="API_DescribeAnomalyDetectors"></a>

Lists the anomaly detection models that you have created in your account. For single metric anomaly detectors, you can list all of the models in your account or filter the results to only the models that are related to a certain namespace, metric name, or metric dimension. For metric math anomaly detectors, you can list them by adding `METRIC_MATH` to the `AnomalyDetectorTypes` array. This will return all metric math anomaly detectors in your account.

## Request Parameters
<a name="API_DescribeAnomalyDetectors_RequestParameters"></a>

 ** AnomalyDetectorTypes **   
The anomaly detector types to request when using `DescribeAnomalyDetectorsInput`. If empty, defaults to `SINGLE_METRIC`.  
Type: Array of strings  
Array Members: Maximum number of 2 items.  
Valid Values: `SINGLE_METRIC | METRIC_MATH`   
Required: No

 ** Dimensions **   
Limits the results to only the anomaly detection models that are associated with the specified metric dimensions. If there are multiple metrics that have these dimensions and have anomaly detection models associated, they're all returned.  
Type: Array of [Dimension](API_Dimension.md) objects  
Array Members: Maximum number of 30 items.  
Required: No

 ** MaxResults **   
The maximum number of results to return in one operation. The maximum value that you can specify is 100.  
To retrieve the remaining results, make another call with the returned `NextToken` value.   
Type: Integer  
Valid Range: Minimum value of 1.  
Required: No

 ** MetricName **   
Limits the results to only the anomaly detection models that are associated with the specified metric name. If there are multiple metrics with this name in different namespaces that have anomaly detection models, they're all returned.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** Namespace **   
Limits the results to only the anomaly detection models that are associated with the specified namespace.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Pattern: `[^:].*`   
Required: No

 ** NextToken **   
Use the token returned by the previous operation to request the next page of results.  
Type: String  
Required: No

## Response Elements
<a name="API_DescribeAnomalyDetectors_ResponseElements"></a>

The following elements are returned by the service.

 ** AnomalyDetectors **   
The list of anomaly detection models returned by the operation.  
Type: Array of [AnomalyDetector](API_AnomalyDetector.md) objects

 ** NextToken **   
A token that you can use in a subsequent operation to retrieve the next set of results.  
Type: String

## Errors
<a name="API_DescribeAnomalyDetectors_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidNextToken **   
The next token specified is invalid.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterCombination **   
Parameters were used together that cannot be used together.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

## Examples
<a name="API_DescribeAnomalyDetectors_Examples"></a>

### Example
<a name="API_DescribeAnomalyDetectors_Example_1"></a>

The following example lists all the anomaly detectors for metrics with the name `CPUUtilization`.

#### Sample Request
<a name="API_DescribeAnomalyDetectors_Example_1_Request"></a>

```
{
    "MetricName:": "CPUUtilization"
}
```

#### Sample Response
<a name="API_DescribeAnomalyDetectors_Example_1_Response"></a>

```
{
    "AnomalyDetectors": [
        {
            "Namespace": "AWS/EC2",
            "MetricName": "CPUUtilization",
            "Dimensions": [
                {
                    "Name": "dimension1",
                    "Value": "value1"
                },
                {
                    "Name": "dimension2",
                    "Value": "value2"
                }
            ],
            "Stat": "Average",
            "Configuration": {
                "ExcludedTimeRanges": [
                    
                ]
            }
        },
        {
            "Namespace": "AWS/EC2",
            "MetricName": "CPUUtilization",
            "Dimensions": [
                {
                    "Name": "dimension1",
                    "Value": "value1"
                }
            ],
            "Stat": "SampleCount",
            "Configuration": {
                "ExcludedTimeRanges": [
                    
                ]
            }
        },
        {
            "Namespace": "APITest1",
            "MetricName": "Metric1",
            "Dimensions": [
                {
                    "Name": "dimension1",
                    "Value": "value1"
                }
            ],
            "Stat": "SampleCount",
            "Configuration": {
                "ExcludedTimeRanges": [
                    
                ]
            }
        },
        {
            "Namespace": "CustomNamespace",
            "MetricName": "CPUUtilization",
            "Dimensions": [
                {
                    "Name": "dimension1",
                    "Value": "value1"
                },
                {
                    "Name": "dimension2",
                    "Value": "value2"
                }
            ],
            "Stat": "Maximum",
            "Configuration": {
                "ExcludedTimeRanges": [
                    
                ]
            }
        }
    ]
}
```

## See Also
<a name="API_DescribeAnomalyDetectors_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DescribeAnomalyDetectors) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DescribeAnomalyDetectors) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DescribeAnomalyDetectors) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DescribeAnomalyDetectors) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DescribeAnomalyDetectors) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DescribeAnomalyDetectors) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DescribeAnomalyDetectors) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DescribeAnomalyDetectors) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DescribeAnomalyDetectors) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DescribeAnomalyDetectors) 

# DescribeInsightRules
<a name="API_DescribeInsightRules"></a>

Returns a list of all the Contributor Insights rules in your account.

For more information about Contributor Insights, see [Using Contributor Insights to Analyze High-Cardinality Data](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/ContributorInsights.html).

## Request Parameters
<a name="API_DescribeInsightRules_RequestParameters"></a>

 ** MaxResults **   
The maximum number of results to return in one operation. If you omit this parameter, the default of 500 is used.  
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 500.  
Required: No

 ** NextToken **   
Include this value, if it was returned by the previous operation, to get the next set of rules.  
Type: String  
Required: No

## Response Elements
<a name="API_DescribeInsightRules_ResponseElements"></a>

The following elements are returned by the service.

 ** InsightRules **   
The rules returned by the operation.  
Type: Array of [InsightRule](API_InsightRule.md) objects

 ** NextToken **   
If this parameter is present, it is a token that marks the start of the next batch of returned results.   
Type: String

## Errors
<a name="API_DescribeInsightRules_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidNextToken **   
The next token specified is invalid.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_DescribeInsightRules_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DescribeInsightRules) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DescribeInsightRules) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DescribeInsightRules) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DescribeInsightRules) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DescribeInsightRules) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DescribeInsightRules) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DescribeInsightRules) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DescribeInsightRules) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DescribeInsightRules) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DescribeInsightRules) 

# DisableAlarmActions
<a name="API_DisableAlarmActions"></a>

Disables the actions for the specified alarms. When an alarm's actions are disabled, the alarm actions do not execute when the alarm state changes.

## Request Parameters
<a name="API_DisableAlarmActions_RequestParameters"></a>

 ** AlarmNames **   
The names of the alarms.  
Type: Array of strings  
Array Members: Maximum number of 100 items.  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

## Errors
<a name="API_DisableAlarmActions_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

## See Also
<a name="API_DisableAlarmActions_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DisableAlarmActions) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DisableAlarmActions) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DisableAlarmActions) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DisableAlarmActions) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DisableAlarmActions) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DisableAlarmActions) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DisableAlarmActions) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DisableAlarmActions) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DisableAlarmActions) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DisableAlarmActions) 

# DisableInsightRules
<a name="API_DisableInsightRules"></a>

Disables the specified Contributor Insights rules. When rules are disabled, they do not analyze log groups and do not incur costs.

## Request Parameters
<a name="API_DisableInsightRules_RequestParameters"></a>

 ** RuleNames **   
An array of the rule names to disable. If you need to find out the names of your rules, use [DescribeInsightRules](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_DescribeInsightRules.html).  
Type: Array of strings  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[\x20-\x7E]+`   
Required: Yes

## Response Elements
<a name="API_DisableInsightRules_ResponseElements"></a>

The following element is returned by the service.

 ** Failures **   
An array listing the rules that could not be disabled. You cannot disable built-in rules.  
Type: Array of [PartialFailure](API_PartialFailure.md) objects

## Errors
<a name="API_DisableInsightRules_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_DisableInsightRules_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/DisableInsightRules) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/DisableInsightRules) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/DisableInsightRules) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/DisableInsightRules) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/DisableInsightRules) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/DisableInsightRules) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/DisableInsightRules) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/DisableInsightRules) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/DisableInsightRules) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/DisableInsightRules) 

# EnableAlarmActions
<a name="API_EnableAlarmActions"></a>

Enables the actions for the specified alarms.

## Request Parameters
<a name="API_EnableAlarmActions_RequestParameters"></a>

 ** AlarmNames **   
The names of the alarms.  
Type: Array of strings  
Array Members: Maximum number of 100 items.  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

## Errors
<a name="API_EnableAlarmActions_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

## See Also
<a name="API_EnableAlarmActions_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/EnableAlarmActions) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/EnableAlarmActions) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/EnableAlarmActions) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/EnableAlarmActions) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/EnableAlarmActions) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/EnableAlarmActions) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/EnableAlarmActions) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/EnableAlarmActions) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/EnableAlarmActions) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/EnableAlarmActions) 

# EnableInsightRules
<a name="API_EnableInsightRules"></a>

Enables the specified Contributor Insights rules. When rules are enabled, they immediately begin analyzing log data.

## Request Parameters
<a name="API_EnableInsightRules_RequestParameters"></a>

 ** RuleNames **   
An array of the rule names to enable. If you need to find out the names of your rules, use [DescribeInsightRules](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_DescribeInsightRules.html).  
Type: Array of strings  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[\x20-\x7E]+`   
Required: Yes

## Response Elements
<a name="API_EnableInsightRules_ResponseElements"></a>

The following element is returned by the service.

 ** Failures **   
An array listing the rules that could not be enabled. You cannot disable or enable built-in rules.  
Type: Array of [PartialFailure](API_PartialFailure.md) objects

## Errors
<a name="API_EnableInsightRules_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** LimitExceededException **   
The operation exceeded one or more limits.  
HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_EnableInsightRules_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/EnableInsightRules) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/EnableInsightRules) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/EnableInsightRules) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/EnableInsightRules) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/EnableInsightRules) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/EnableInsightRules) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/EnableInsightRules) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/EnableInsightRules) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/EnableInsightRules) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/EnableInsightRules) 

# GetAlarmMuteRule
<a name="API_GetAlarmMuteRule"></a>

Retrieves details for a specific alarm mute rule.

This operation returns complete information about the mute rule, including its configuration, status, targeted alarms, and metadata.

The returned status indicates the current state of the mute rule:
+  **SCHEDULED**: The mute rule is configured and will become active in the future
+  **ACTIVE**: The mute rule is currently muting alarm actions
+  **EXPIRED**: The mute rule has passed its expiration date and will no longer become active

 **Permissions** 

To retrieve details for a mute rule, you need the `cloudwatch:GetAlarmMuteRule` permission on the alarm mute rule resource.

## Request Parameters
<a name="API_GetAlarmMuteRule_RequestParameters"></a>

 ** AlarmMuteRuleName **   
The name of the alarm mute rule to retrieve.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

## Response Elements
<a name="API_GetAlarmMuteRule_ResponseElements"></a>

The following elements are returned by the service.

 ** AlarmMuteRuleArn **   
The Amazon Resource Name (ARN) of the alarm mute rule.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1600.

 ** Description **   
The description of the alarm mute rule.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1024.

 ** ExpireDate **   
The date and time when the mute rule expires and is no longer evaluated.  
Type: Timestamp

 ** LastUpdatedTimestamp **   
The date and time when the mute rule was last updated.  
Type: Timestamp

 ** MuteTargets **   
Specifies which alarms this rule applies to.  
Type: [MuteTargets](API_MuteTargets.md) object

 ** MuteType **   
Indicates whether the mute rule is one-time or recurring. Valid values are `ONE_TIME` or `RECURRING`.  
Type: String

 ** Name **   
The name of the alarm mute rule.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.

 ** Rule **   
The configuration that defines when and how long alarms are muted.  
Type: [Rule](API_Rule.md) object

 ** StartDate **   
The date and time when the mute rule becomes active. If not set, the rule is active immediately.  
Type: Timestamp

 ** Status **   
The current status of the alarm mute rule. Valid values are `SCHEDULED`, `ACTIVE`, or `EXPIRED`.  
Type: String  
Valid Values: `SCHEDULED | ACTIVE | EXPIRED` 

## Errors
<a name="API_GetAlarmMuteRule_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ResourceNotFoundException **   
The named resource does not exist.  
HTTP Status Code: 404

## Examples
<a name="API_GetAlarmMuteRule_Examples"></a>

### Get details for a mute rule
<a name="API_GetAlarmMuteRule_Example_1"></a>

Retrieve complete details for a specific alarm mute rule.

#### Sample Request
<a name="API_GetAlarmMuteRule_Example_1_Request"></a>

```
aws cloudwatch get-alarm-mute-rule \
	--alarm-mute-rule-name "DailyMaintenanceWindow"
```

#### Sample Response
<a name="API_GetAlarmMuteRule_Example_1_Response"></a>

```
{
    "Name": "DailyMaintenanceWindow",
    "AlarmMuteRuleArn": "arn:aws:cloudwatch:us-east-1:123456789012:alarm-mute-rule:DailyMaintenanceWindow",
    "Description": "Mute alarms during daily maintenance",
    "Rule": {
        "Schedule": {
            "Expression": "cron(0 2 * * ?)",
            "Duration": "PT2H",
            "Timezone": "UTC"
        }
    },
    "MuteTargets": {
        "AlarmNames": [
            "WebServerCPUAlarm",
            "DatabaseConnectionAlarm"
        ]
    },
    "Status": "SCHEDULED",
    "LastUpdatedTimestamp": "2026-01-15T10:30:00Z"
}
```

## See Also
<a name="API_GetAlarmMuteRule_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/GetAlarmMuteRule) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/GetAlarmMuteRule) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/GetAlarmMuteRule) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/GetAlarmMuteRule) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/GetAlarmMuteRule) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/GetAlarmMuteRule) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/GetAlarmMuteRule) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/GetAlarmMuteRule) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/GetAlarmMuteRule) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/GetAlarmMuteRule) 

# GetDashboard
<a name="API_GetDashboard"></a>

Displays the details of the dashboard that you specify.

To copy an existing dashboard, use `GetDashboard`, and then use the data returned within `DashboardBody` as the template for the new dashboard when you call `PutDashboard` to create the copy.

## Request Parameters
<a name="API_GetDashboard_RequestParameters"></a>

 ** DashboardName **   
The name of the dashboard to be described.  
Type: String  
Required: Yes

## Response Elements
<a name="API_GetDashboard_ResponseElements"></a>

The following elements are returned by the service.

 ** DashboardArn **   
The Amazon Resource Name (ARN) of the dashboard.  
Type: String

 ** DashboardBody **   
The detailed information about the dashboard, including what widgets are included and their location on the dashboard. For more information about the `DashboardBody` syntax, see [Dashboard Body Structure and Syntax](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html).   
Type: String

 ** DashboardName **   
The name of the dashboard.  
Type: String

## Errors
<a name="API_GetDashboard_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFound **   
The specified dashboard does not exist.  
HTTP Status Code: 404

## See Also
<a name="API_GetDashboard_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/GetDashboard) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/GetDashboard) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/GetDashboard) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/GetDashboard) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/GetDashboard) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/GetDashboard) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/GetDashboard) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/GetDashboard) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/GetDashboard) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/GetDashboard) 

# GetInsightRuleReport
<a name="API_GetInsightRuleReport"></a>

This operation returns the time series data collected by a Contributor Insights rule. The data includes the identity and number of contributors to the log group.

You can also optionally return one or more statistics about each data point in the time series. These statistics can include the following:
+  `UniqueContributors` -- the number of unique contributors for each data point.
+  `MaxContributorValue` -- the value of the top contributor for each data point. The identity of the contributor might change for each data point in the graph.

  If this rule aggregates by COUNT, the top contributor for each data point is the contributor with the most occurrences in that period. If the rule aggregates by SUM, the top contributor is the contributor with the highest sum in the log field specified by the rule's `Value`, during that period.
+  `SampleCount` -- the number of data points matched by the rule.
+  `Sum` -- the sum of the values from all contributors during the time period represented by that data point.
+  `Minimum` -- the minimum value from a single observation during the time period represented by that data point.
+  `Maximum` -- the maximum value from a single observation during the time period represented by that data point.
+  `Average` -- the average value from all contributors during the time period represented by that data point.

## Request Parameters
<a name="API_GetInsightRuleReport_RequestParameters"></a>

 ** EndTime **   
The end time of the data to use in the report. When used in a raw HTTP Query API, it is formatted as `yyyy-MM-dd'T'HH:mm:ss`. For example, `2019-07-01T23:59:59`.  
Type: Timestamp  
Required: Yes

 ** MaxContributorCount **   
The maximum number of contributors to include in the report. The range is 1 to 100. If you omit this, the default of 10 is used.  
Type: Integer  
Required: No

 ** Metrics **   
Specifies which metrics to use for aggregation of contributor values for the report. You can specify one or more of the following metrics:  
+  `UniqueContributors` -- the number of unique contributors for each data point.
+  `MaxContributorValue` -- the value of the top contributor for each data point. The identity of the contributor might change for each data point in the graph.

  If this rule aggregates by COUNT, the top contributor for each data point is the contributor with the most occurrences in that period. If the rule aggregates by SUM, the top contributor is the contributor with the highest sum in the log field specified by the rule's `Value`, during that period.
+  `SampleCount` -- the number of data points matched by the rule.
+  `Sum` -- the sum of the values from all contributors during the time period represented by that data point.
+  `Minimum` -- the minimum value from a single observation during the time period represented by that data point.
+  `Maximum` -- the maximum value from a single observation during the time period represented by that data point.
+  `Average` -- the average value from all contributors during the time period represented by that data point.
Type: Array of strings  
Length Constraints: Minimum length of 1. Maximum length of 32.  
Pattern: `[\x20-\x7E]+`   
Required: No

 ** OrderBy **   
Determines what statistic to use to rank the contributors. Valid values are `Sum` and `Maximum`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 32.  
Pattern: `[\x20-\x7E]+`   
Required: No

 ** Period **   
The period, in seconds, to use for the statistics in the `InsightRuleMetricDatapoint` results.  
Type: Integer  
Valid Range: Minimum value of 1.  
Required: Yes

 ** RuleName **   
The name of the rule that you want to see data from.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[\x20-\x7E]+`   
Required: Yes

 ** StartTime **   
The start time of the data to use in the report. When used in a raw HTTP Query API, it is formatted as `yyyy-MM-dd'T'HH:mm:ss`. For example, `2019-07-01T23:59:59`.  
Type: Timestamp  
Required: Yes

## Response Elements
<a name="API_GetInsightRuleReport_ResponseElements"></a>

The following elements are returned by the service.

 ** AggregateValue **   
The sum of the values from all individual contributors that match the rule.  
Type: Double

 ** AggregationStatistic **   
Specifies whether this rule aggregates contributor data by COUNT or SUM.  
Type: String

 ** ApproximateUniqueCount **   
An approximate count of the unique contributors found by this rule in this time period.  
Type: Long

 ** Contributors **   
An array of the unique contributors found by this rule in this time period. If the rule contains multiple keys, each combination of values for the keys counts as a unique contributor.  
Type: Array of [InsightRuleContributor](API_InsightRuleContributor.md) objects

 ** KeyLabels **   
An array of the strings used as the keys for this rule. The keys are the dimensions used to classify contributors. If the rule contains more than one key, then each unique combination of values for the keys is counted as a unique contributor.  
Type: Array of strings

 ** MetricDatapoints **   
A time series of metric data points that matches the time period in the rule request.  
Type: Array of [InsightRuleMetricDatapoint](API_InsightRuleMetricDatapoint.md) objects

## Errors
<a name="API_GetInsightRuleReport_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFoundException **   
The named resource does not exist.  
HTTP Status Code: 404

## See Also
<a name="API_GetInsightRuleReport_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/GetInsightRuleReport) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/GetInsightRuleReport) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/GetInsightRuleReport) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/GetInsightRuleReport) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/GetInsightRuleReport) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/GetInsightRuleReport) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/GetInsightRuleReport) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/GetInsightRuleReport) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/GetInsightRuleReport) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/GetInsightRuleReport) 

# GetMetricData
<a name="API_GetMetricData"></a>

You can use the `GetMetricData` API to retrieve CloudWatch metric values. The operation can also include a CloudWatch Metrics Insights query, and one or more metric math functions.

A `GetMetricData` operation that does not include a query can retrieve as many as 500 different metrics in a single request, with a total of as many as 100,800 data points. You can also optionally perform metric math expressions on the values of the returned statistics, to create new time series that represent new insights into your data. For example, using Lambda metrics, you could divide the Errors metric by the Invocations metric to get an error rate time series. For more information about metric math expressions, see [Metric Math Syntax and Functions](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/using-metric-math.html#metric-math-syntax) in the *Amazon CloudWatch User Guide*.

If you include a Metrics Insights query, each `GetMetricData` operation can include only one query. But the same `GetMetricData` operation can also retrieve other metrics. Metrics Insights queries can query only the most recent three hours of metric data. For more information about Metrics Insights, see [Query your metrics with CloudWatch Metrics Insights](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/query_with_cloudwatch-metrics-insights.html).

Calls to the `GetMetricData` API have a different pricing structure than calls to `GetMetricStatistics`. For more information about pricing, see [Amazon CloudWatch Pricing](https://aws.amazon.com/cloudwatch/pricing/).

Amazon CloudWatch retains metric data as follows:
+ Data points with a period of less than 60 seconds are available for 3 hours. These data points are high-resolution metrics and are available only for custom metrics that have been defined with a `StorageResolution` of 1.
+ Data points with a period of 60 seconds (1-minute) are available for 15 days.
+ Data points with a period of 300 seconds (5-minute) are available for 63 days.
+ Data points with a period of 3600 seconds (1 hour) are available for 455 days (15 months).

Data points that are initially published with a shorter period are aggregated together for long-term storage. For example, if you collect data using a period of 1 minute, the data remains available for 15 days with 1-minute resolution. After 15 days, this data is still available, but is aggregated and retrievable only with a resolution of 5 minutes. After 63 days, the data is further aggregated and is available with a resolution of 1 hour.

If you omit `Unit` in your request, all data that was collected with any unit is returned, along with the corresponding units that were specified when the data was reported to CloudWatch. If you specify a unit, the operation returns only data that was collected with that unit specified. If you specify a unit that does not match the data collected, the results of the operation are null. CloudWatch does not perform unit conversions.

 **Using Metrics Insights queries with metric math** 

You can't mix a Metric Insights query and metric math syntax in the same expression, but you can reference results from a Metrics Insights query within other Metric math expressions. A Metrics Insights query without a **GROUP BY** clause returns a single time-series (TS), and can be used as input for a metric math expression that expects a single time series. A Metrics Insights query with a **GROUP BY** clause returns an array of time-series (TS[]), and can be used as input for a metric math expression that expects an array of time series. 

## Request Parameters
<a name="API_GetMetricData_RequestParameters"></a>

 ** EndTime **   
The time stamp indicating the latest data to be returned.  
The value specified is exclusive; results include data points up to the specified time stamp.  
For better performance, specify `StartTime` and `EndTime` values that align with the value of the metric's `Period` and sync up with the beginning and end of an hour. For example, if the `Period` of a metric is 5 minutes, specifying 12:05 or 12:30 as `EndTime` can get a faster response from CloudWatch than setting 12:07 or 12:29 as the `EndTime`.  
Type: Timestamp  
Required: Yes

 ** LabelOptions **   
This structure includes the `Timezone` parameter, which you can use to specify your time zone so that the labels of returned data display the correct time for your time zone.   
Type: [LabelOptions](API_LabelOptions.md) object  
Required: No

 ** MaxDatapoints **   
The maximum number of data points the request should return before paginating. If you omit this, the default of 100,800 is used.  
Type: Integer  
Required: No

 ** MetricDataQueries **   
The metric queries to be returned. A single `GetMetricData` call can include as many as 500 `MetricDataQuery` structures. Each of these structures can specify either a metric to retrieve, a Metrics Insights query, or a math expression to perform on retrieved data.   
Type: Array of [MetricDataQuery](API_MetricDataQuery.md) objects  
Required: Yes

 ** NextToken **   
Include this value, if it was returned by the previous `GetMetricData` operation, to get the next set of data points.  
Type: String  
Required: No

 ** ScanBy **   
The order in which data points should be returned. `TimestampDescending` returns the newest data first and paginates when the `MaxDatapoints` limit is reached. `TimestampAscending` returns the oldest data first and paginates when the `MaxDatapoints` limit is reached.  
If you omit this parameter, the default of `TimestampDescending` is used.  
Type: String  
Valid Values: `TimestampDescending | TimestampAscending`   
Required: No

 ** StartTime **   
The time stamp indicating the earliest data to be returned.  
The value specified is inclusive; results include data points with the specified time stamp.   
CloudWatch rounds the specified time stamp as follows:  
+ Start time less than 15 days ago - Round down to the nearest whole minute. For example, 12:32:34 is rounded down to 12:32:00.
+ Start time between 15 and 63 days ago - Round down to the nearest 5-minute clock interval. For example, 12:32:34 is rounded down to 12:30:00.
+ Start time greater than 63 days ago - Round down to the nearest 1-hour clock interval. For example, 12:32:34 is rounded down to 12:00:00.
If you set `Period` to 5, 10, 20, or 30, the start time of your request is rounded down to the nearest time that corresponds to even 5-, 10-, 20-, or 30-second divisions of a minute. For example, if you make a query at (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of your request is rounded down and you receive data from 01:05:10 to 01:05:20. If you make a query at 15:07:17 for the previous 5 minutes of data, using a period of 5 seconds, you receive data timestamped between 15:02:15 and 15:07:15.   
For better performance, specify `StartTime` and `EndTime` values that align with the value of the metric's `Period` and sync up with the beginning and end of an hour. For example, if the `Period` of a metric is 5 minutes, specifying 12:05 or 12:30 as `StartTime` can get a faster response from CloudWatch than setting 12:07 or 12:29 as the `StartTime`.  
Type: Timestamp  
Required: Yes

## Response Elements
<a name="API_GetMetricData_ResponseElements"></a>

The following elements are returned by the service.

 ** Messages **   
Contains a message about this `GetMetricData` operation, if the operation results in such a message. An example of a message that might be returned is `Maximum number of allowed metrics exceeded`. If there is a message, as much of the operation as possible is still executed.  
A message appears here only if it is related to the global `GetMetricData` operation. Any message about a specific metric returned by the operation appears in the `MetricDataResult` object returned for that metric.  
Type: Array of [MessageData](API_MessageData.md) objects

 ** MetricDataResults **   
The metrics that are returned, including the metric name, namespace, and dimensions.  
Type: Array of [MetricDataResult](API_MetricDataResult.md) objects

 ** NextToken **   
A token that marks the next batch of returned results.  
Type: String

## Errors
<a name="API_GetMetricData_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidNextToken **   
The next token specified is invalid.    
 ** message **   

HTTP Status Code: 400

## Examples
<a name="API_GetMetricData_Examples"></a>

### Example
<a name="API_GetMetricData_Example_1"></a>

The following example requests a Metrics Insights query for aggregated `CPUUtilization`, and a metric.

#### Sample Request
<a name="API_GetMetricData_Example_1_Request"></a>

```
{
    "StartTime": 1637061900,
    "EndTime": 1637074500,
    "MetricDataQueries": [
        {
            "Expression": "SELECT AVG(CPUUtilization) FROM SCHEMA(\"AWS/EC2\", InstanceId)",
            "Id": "q1",
            "Period": 300,
            "Label": "Cluster CpuUtilization"
        },
        {
            "Id": "m1",
            "Label": "Unhealthy Behind Load Balancer",
            "MetricStat": {
                "Metric": {
                    "Namespace": "AWS/ApplicationELB",
                    "MetricName": "UnHealthyHostCount",
                    "Dimensions": [
                        {
                            "Name": "TargetGroup",
                            "Value": "targetgroup/EC2Co-Defau-EXAMPLEWNAD/89cc68152b367e5f"
                        },
                        {
                            "Name": "LoadBalancer",
                            "Value": "app/EC2Co-EcsEl-EXAMPLE69Q/fdd2210e799e4376"
                        }
                    ]
                },
                "Period": 300,
                "Stat": "Average"
            }
        }
    ]
}
```

#### Sample Response
<a name="API_GetMetricData_Example_1_Response"></a>

```
{
    "Messages": [],
    "MetricDataResults": [
        {
            "Id": "m1",
            "Label": "Unhealthy Behind Load Balancer",
            "StatusCode": "Complete",
            "Timestamps": [
                1637074200,      
                1637073900,
                1637073600
            ],
            "Values": [
                0,
                0,
                0
            ]
        },
        {
            "Id": "q1",
            "Label": "Cluster CpuUtilization",
            "StatusCode": "Complete",
            "Timestamps": [
                1637074245,
                1637073945,
                1637073645
            ],
            "Values": [
                1.2158469945359334,
                0.8678863271635757,
                0.7201860957623283
            ]
        }
    ]
}
```

### Example
<a name="API_GetMetricData_Example_2"></a>

The following example includes a Metrics Insights query for that is given the ID `error_rate`. The returned results of the query are then used in the metric math expression to return `availability`. 

#### Sample Request
<a name="API_GetMetricData_Example_2_Request"></a>

```
{
    "StartTime": 1518867432,
    "EndTime": 1518868032,
    "MetricQueries": [
        {
            "Id": "availability",
            "Expression": "(1 - error_rate) * 100",
            "Label": "Availability"
        },
        {
            "Id": " error_rate",
            "Expression": "SELECT AVG(ErrorRate) FROM MyService",
            "Period": 300,
            "ReturnData": false
        }
    ]
}
```

### Example
<a name="API_GetMetricData_Example_3"></a>

The following example requests three separate metrics across two namespaces. The labels of the first two metrics use dynamic labels to display the peak value of `CPUUtilization` during the time shown on the graph, and also the time that the peak value was recorded. The `Timezone` setting specifies that the times shown in those dynamic labels reflect the United States Eastern time zone, which is 4 hours behind UTC.

#### Sample Request
<a name="API_GetMetricData_Example_3_Request"></a>

```
{
  "StartTime": 1518867432,
  "EndTime": 1518868232,
  "LabelOptions": {
    "Timezone" : "-0400"
    },
  "MetricDataQueries": [
    {
      "Id": "m1",
      "Label": "CPUUtilization, peak of ${MAX} was at ${MAX_TIME}",
      "MetricStat": {
        "Metric": {
          "Namespace": "AWS/EC2",
          "MetricName": "CPUUtilization",
          "Dimensions": [
            {
              "Name": "InstanceId",
              "Value": "i-1234567890abcdef0"
            }
          ]
        },
        "Period": 300,
        "Stat": "Average"
      }
    },
    {
      "Id": "m2",
      "Label": "CPUUtilization, peak of ${MAX} was at ${MAX_TIME}",
      "MetricStat": {
        "Metric": {
          "Namespace": "AWS/EC2",
          "MetricName": "CPUUtilization",
          "Dimensions": [
            {
              "Name": "InstanceId",
              "Value": "i-111111111111111111"
            }
          ]
        },
        "Period": 300,
        "Stat": "Average"
      }
    },
    {
      "Id": "m3",
      "MetricStat": {
        "Metric": {
          "Namespace": "AWS/ELB",
          "MetricName": "HealthyHostCount",
          "Dimensions": [
            {
              "Name": "LoadBalancerName",
              "Value": "my-lb-B"
            }
          ]
        },
        "Period": 300,
        "Stat": "Sum",
        "Unit": "None"
      }
    }
  ]
}
```

#### Sample Response
<a name="API_GetMetricData_Example_3_Response"></a>

```
{
  "MetricDataResults": [
    {
      "Id": "m1",
      "StatusCode": "Complete",
      "Label": "CPUUtilization, peak of 31.5 was at 1-22 13:05",
      "Timestamps": [
        1518868032,      
        1518867732,
        1518867432
      ],
      "Values": [
        15000,
        14000,
        16000
      ]
    },
    {
      "Id": "m2",
      "StatusCode": "Complete",
      "Label": "CPUUtilization, peak of 63.2 was at 1-22 13:20",
      "Timestamps": [
        1518868032,
        1518867732,
        1518867432
      ],
      "Values": [
        15,
        14,
        16
      ]
    },
    {
      "Id": "m3",
      "StatusCode": "Complete",
      "Label": "AWS/EC2 HealthyHostCount",
      "Timestamps": [
        1518868032,
        1518867732,
        1518867432
      ],
      "Values": [
        15,
        14,
        16
      ]
    }
  ]
}
```

### Example
<a name="API_GetMetricData_Example_4"></a>

The following example retrieves the `NetworkOut` metric for two Auto Scaling groups, and uses them in an expression. These two metrics are called m1 and m2, and the expression calculates e1 as the results of m2/m1. The raw values and time stamps of the `NetworkOut` metrics are not returned.

#### Sample Request
<a name="API_GetMetricData_Example_4_Request"></a>

```
{
  "StartTime": 1518867432,
  "EndTime": 1518868232,
  "MetricQueries": [
    {
      "Id": "e1",
      "Expression": "m2 / m1",
      "Label": "my-asg-B / my-asg-A"
    },
    {
      "Id": "m1",
      "MetricStat": {
        "Metric": {
          "Namespace": "AWS/EC2",
          "MetricName": "NetworkOut",
          "Dimensions": [
            {
              "Name": "AutoScalingGroupName",
              "Value": "my-asg-A"
            }
          ]
        },
        "Period": 300,
        "Stat": "SampleCount",
        "Unit": "Bytes"
      },
      "ReturnData": false
    },
    {
      "Id": "m2",
      "MetricStat": {
        "Metric": {
          "Namespace": "AWS/EC2",
          "MetricName": "NetworkOut",
          "Dimensions": [
            {
              "Name": "AutoScalingGroupName",
              "Value": "my-asg-B"
            }
          ]
        },
        "Period": 300,
        "Stat": "SampleCount",
        "Unit": "Bytes"
      },
      "ReturnData": false
    }
  ]
}
```

#### Sample Response
<a name="API_GetMetricData_Example_4_Response"></a>

```
{
  "MetricDataResults": [
    {
      "Id": "m1",
      "StatusCode": "Complete"
    },
    {
      "Id": "m2",
      "StatusCode": "Complete"
    },
    {
      "Id": "e1",
      "StatusCode": "Complete",
      "Label": "my-asg-B / my-asg-A",
      "Timestamps": [
        1518868032,
        1518867732,
        1518867432
      ],
      "Values": [
        100,
        100,
        100
      ]
    }
  ]
}
```

### Example
<a name="API_GetMetricData_Example_5"></a>

In the following example, two levels of metric math expressions are used, with the result of one expression used as an input to the next expression:

#### Sample Request
<a name="API_GetMetricData_Example_5_Request"></a>

```
{
  "StartTime": 1518867432,
  "EndTime": 1518868232,
  "MetricDataQueries": [
    {
      "Id": "e1",
      "Expression": "e2 + m3",
      "Label": "my-asg-A * my-asg-B + my-asg-C"
    },
    {
      "Id": "e2",
      "Expression": "m1 * m2",
       "Label": "my-asg-A * my-asg-B"
    },
    {
      "Id": "m1",
      "MetricStat": {
        "Metric": {
          "Namespace": "AWS/EC2",
          "MetricName": "NetworkOut",
          "Dimensions": [
            {
              "Name": "AutoScalingGroupName",
              "Value": "my-asg-A"
            }
          ]
        },
        "Period": 300,
        "Stat": "SampleCount",
        "Unit": "Bytes"
      },
      "ReturnData": false
    },
    {
      "Id": "m2",
      "MetricStat": {
        "Metric": {
          "Namespace": "AWS/EC2",
          "MetricName": "NetworkOut",
          "Dimensions": [
            {
              "Name": "AutoScalingGroupName",
              "Value": "my-asg-B"
            }
          ]
        },
        "Period": 300,
        "Stat": "SampleCount",
        "Unit": "Bytes"
      },
      "ReturnData": false
    },
    {
      "Id": "m3",
      "MetricStat": {
        "Metric": {
          "Namespace": "AWS/EC2",
          "MetricName": "NetworkOut",
          "Dimensions": [
            {
              "Name": "AutoScalingGroupName",
              "Value": "my-asg-C"
            }
          ]
        },
        "Period": 300,
        "Stat": "SampleCount",
        "Unit": "Bytes"
      },
      "ReturnData": false
    }
  ]
}
```

#### Sample Response
<a name="API_GetMetricData_Example_5_Response"></a>

```
{
  "MetricDataResults": [
    {
      "Id": "m1",
      "StatusCode": "Complete"
    },
    {
      "Id": "m2",
      "StatusCode": "Complete"
    },
    {
      "Id": "m3",
      "StatusCode": "Complete"
    },
    {
      "Id": "e1",
      "StatusCode": "Complete",
      "Label": "my-asg-A * my-asg-B + my-asg-C",
      "Timestamps": [
        1518868032,
        1518867732,
        1518867432
      ],
      "Values": [
        200,
        200,
        200
      ]
    },
    {
      "Id": "e2",
      "StatusCode": "Complete",
      "Label": "my-asg-A * my-asg-B",
      "Timestamps": [
        1518868032,
        1518867732,
        1518867432
      ],
      "Values": [
        100,
        100,
        100
      ]
    }
  ]
}
```

### Example
<a name="API_GetMetricData_Example_6"></a>

In the following example, custom metrics are searched and assigned IDs that contain either "error" or "request", even if the original metric names did not contain those words. Then an error rate is calculated using the `METRICS("string")` function on the assigned IDs.

#### Sample Request
<a name="API_GetMetricData_Example_6_Request"></a>

```
{
  "StartTime": 1518867432,
  "EndTime": 1518868432,
  "MetricDataQueries": [
    {
      "Id": "errorRate",
      "Label": "Error Rate",
      "Expression": "errors/requests"
    },
    {
      "Id": "errorRatePercent",
      "Label": "% Error Rate",
      "Expression": "errorRate*100"
    },
    {
      "Id": "requests",
      "Expression": "SUM(METRICS('request'))",
      "ReturnData": false
    },
    {
      "Id": "errors",
      "Expression": "SUM(METRICS('error'))",
      "ReturnData": false
    },
    {
      "Id": "error1",
      "MetricStat": {
        "Metric": {
          "Namespace": "MyService",
          "MetricName": "BadRequests",
          "Dimensions": [
            {
              "Name": "Component",
              "Value": "component-1"
            }
          ]
        },
        "Period": 60,
        "Stat": "Sum"
      },
      "ReturnData": false
    },
    {
      "Id": "error2",
      "MetricStat": {
        "Metric": {
          "Namespace": "MyService",
          "MetricName": "ConnectionErrors",
          "Dimensions": [
            {
              "Name": "Component",
              "Value": "component-1"
            }
          ]
        },
        "Period": 60,
        "Stat": "Sum"
      },
      "ReturnData": false
    },
    {
      "Id": "request1",
      "MetricStat": {
        "Metric": {
          "Namespace": "MyService",
          "MetricName": "InternalRequests",
          "Dimensions": [
            {
              "Name": "Component",
              "Value": "component-1"
            }
          ]
        },
        "Period": 60,
        "Stat": "Sum"
      },
      "ReturnData": false
    },
    {
      "Id": "request2",
      "MetricStat": {
        "Metric": {
          "Namespace": "MyService",
          "MetricName": "ExternalRequests",
          "Dimensions": [
            {
              "Name": "Component",
              "Value": "component-1"
            }
          ]
        },
        "Period": 60,
        "Stat": "Sum"
      },
      "ReturnData": false
    }
  ]
}
```

#### Sample Response
<a name="API_GetMetricData_Example_6_Response"></a>

```
{
  "MetricDataResults": [
    {
      "Id": "errorRate",
      "Label": "Error Rate",
      "StatusCode": "Complete",
      "Timestamps": [
        1518868032,
        1518867732,
        1518867432
      ],
      "Values": [
        0.1,
        0.5,
        0.3
      ]
    },
    {
      "Id": "errorRatePercent",
      "Label": "% Error Rate",
      "StatusCode": "Complete",
      "Timestamps": [
        1518868032,
        1518867732,
        1518867432
      ],
      "Values": [
        10,
        50,
        30
      ]
    }
  ]
}
```

## See Also
<a name="API_GetMetricData_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/GetMetricData) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/GetMetricData) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/GetMetricData) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/GetMetricData) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/GetMetricData) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/GetMetricData) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/GetMetricData) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/GetMetricData) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/GetMetricData) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/GetMetricData) 

# GetMetricStatistics
<a name="API_GetMetricStatistics"></a>

Gets statistics for the specified metric.

The maximum number of data points returned from a single call is 1,440. If you request more than 1,440 data points, CloudWatch returns an error. To reduce the number of data points, you can narrow the specified time range and make multiple requests across adjacent time ranges, or you can increase the specified period. Data points are not returned in chronological order.

CloudWatch aggregates data points based on the length of the period that you specify. For example, if you request statistics with a one-hour period, CloudWatch aggregates all data points with time stamps that fall within each one-hour period. Therefore, the number of values aggregated by CloudWatch is larger than the number of data points returned.

CloudWatch needs raw data points to calculate percentile statistics. If you publish data using a statistic set instead, you can only retrieve percentile statistics for this data if one of the following conditions is true:
+ The SampleCount value of the statistic set is 1.
+ The Min and the Max values of the statistic set are equal.

Percentile statistics are not available for metrics when any of the metric values are negative numbers.

Amazon CloudWatch retains metric data as follows:
+ Data points with a period of less than 60 seconds are available for 3 hours. These data points are high-resolution metrics and are available only for custom metrics that have been defined with a `StorageResolution` of 1.
+ Data points with a period of 60 seconds (1-minute) are available for 15 days.
+ Data points with a period of 300 seconds (5-minute) are available for 63 days.
+ Data points with a period of 3600 seconds (1 hour) are available for 455 days (15 months).

Data points that are initially published with a shorter period are aggregated together for long-term storage. For example, if you collect data using a period of 1 minute, the data remains available for 15 days with 1-minute resolution. After 15 days, this data is still available, but is aggregated and retrievable only with a resolution of 5 minutes. After 63 days, the data is further aggregated and is available with a resolution of 1 hour.

CloudWatch started retaining 5-minute and 1-hour metric data as of July 9, 2016.

For information about metrics and dimensions supported by Amazon services, see the [Amazon CloudWatch Metrics and Dimensions Reference](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html) in the *Amazon CloudWatch User Guide*.

## Request Parameters
<a name="API_GetMetricStatistics_RequestParameters"></a>

 ** Dimensions **   
The dimensions. If the metric contains multiple dimensions, you must include a value for each dimension. CloudWatch treats each unique combination of dimensions as a separate metric. If a specific combination of dimensions was not published, you can't retrieve statistics for it. You must specify the same dimensions that were used when the metrics were created. For an example, see [Dimension Combinations](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations) in the *Amazon CloudWatch User Guide*. For more information about specifying dimensions, see [Publishing Metrics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/publishingMetrics.html) in the *Amazon CloudWatch User Guide*.  
Type: Array of [Dimension](API_Dimension.md) objects  
Array Members: Maximum number of 30 items.  
Required: No

 ** EndTime **   
The time stamp that determines the last data point to return.  
The value specified is exclusive; results include data points up to the specified time stamp. In a raw HTTP query, the time stamp must be in ISO 8601 UTC format (for example, 2016-10-10T23:00:00Z).  
Type: Timestamp  
Required: Yes

 ** ExtendedStatistics **   
The percentile statistics. Specify values between p0.0 and p100. When calling `GetMetricStatistics`, you must specify either `Statistics` or `ExtendedStatistics`, but not both. Percentile statistics are not available for metrics when any of the metric values are negative numbers.  
Type: Array of strings  
Array Members: Minimum number of 1 item. Maximum number of 10 items.  
Required: No

 ** MetricName **   
The name of the metric, with or without spaces.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

 ** Namespace **   
The namespace of the metric, with or without spaces.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Pattern: `[^:].*`   
Required: Yes

 ** Period **   
The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a `PutMetricData` call that includes a `StorageResolution` of 1 second.  
If the `StartTime` parameter specifies a time stamp that is greater than 3 hours ago, you must specify the period as follows or no data points in that time range is returned:  
+ Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute).
+ Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
+ Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).
Type: Integer  
Valid Range: Minimum value of 1.  
Required: Yes

 ** StartTime **   
The time stamp that determines the first data point to return. Start times are evaluated relative to the time that CloudWatch receives the request.  
The value specified is inclusive; results include data points with the specified time stamp. In a raw HTTP query, the time stamp must be in ISO 8601 UTC format (for example, 2016-10-03T23:00:00Z).  
CloudWatch rounds the specified time stamp as follows:  
+ Start time less than 15 days ago - Round down to the nearest whole minute. For example, 12:32:34 is rounded down to 12:32:00.
+ Start time between 15 and 63 days ago - Round down to the nearest 5-minute clock interval. For example, 12:32:34 is rounded down to 12:30:00.
+ Start time greater than 63 days ago - Round down to the nearest 1-hour clock interval. For example, 12:32:34 is rounded down to 12:00:00.
If you set `Period` to 5, 10, 20, or 30, the start time of your request is rounded down to the nearest time that corresponds to even 5-, 10-, 20-, or 30-second divisions of a minute. For example, if you make a query at (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of your request is rounded down and you receive data from 01:05:10 to 01:05:20. If you make a query at 15:07:17 for the previous 5 minutes of data, using a period of 5 seconds, you receive data timestamped between 15:02:15 and 15:07:15.   
Type: Timestamp  
Required: Yes

 ** Statistics **   
The metric statistics, other than percentile. For percentile statistics, use `ExtendedStatistics`. When calling `GetMetricStatistics`, you must specify either `Statistics` or `ExtendedStatistics`, but not both.  
Type: Array of strings  
Array Members: Minimum number of 1 item. Maximum number of 5 items.  
Valid Values: `SampleCount | Average | Sum | Minimum | Maximum`   
Required: No

 ** Unit **   
The unit for a given metric. If you omit `Unit`, all data that was collected with any unit is returned, along with the corresponding units that were specified when the data was reported to CloudWatch. If you specify a unit, the operation returns only data that was collected with that unit specified. If you specify a unit that does not match the data collected, the results of the operation are null. CloudWatch does not perform unit conversions.  
Type: String  
Valid Values: `Seconds | Microseconds | Milliseconds | Bytes | Kilobytes | Megabytes | Gigabytes | Terabytes | Bits | Kilobits | Megabits | Gigabits | Terabits | Percent | Count | Bytes/Second | Kilobytes/Second | Megabytes/Second | Gigabytes/Second | Terabytes/Second | Bits/Second | Kilobits/Second | Megabits/Second | Gigabits/Second | Terabits/Second | Count/Second | None`   
Required: No

## Response Elements
<a name="API_GetMetricStatistics_ResponseElements"></a>

The following elements are returned by the service.

 ** Datapoints **   
The data points for the specified metric.  
Type: Array of [Datapoint](API_Datapoint.md) objects

 ** Label **   
A label for the specified metric.  
Type: String

## Errors
<a name="API_GetMetricStatistics_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterCombination **   
Parameters were used together that cannot be used together.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_GetMetricStatistics_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/GetMetricStatistics) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/GetMetricStatistics) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/GetMetricStatistics) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/GetMetricStatistics) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/GetMetricStatistics) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/GetMetricStatistics) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/GetMetricStatistics) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/GetMetricStatistics) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/GetMetricStatistics) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/GetMetricStatistics) 

# GetMetricStream
<a name="API_GetMetricStream"></a>

Returns information about the metric stream that you specify.

## Request Parameters
<a name="API_GetMetricStream_RequestParameters"></a>

 ** Name **   
The name of the metric stream to retrieve information about.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

## Response Elements
<a name="API_GetMetricStream_ResponseElements"></a>

The following elements are returned by the service.

 ** Arn **   
The ARN of the metric stream.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.

 ** CreationDate **   
The date that the metric stream was created.  
Type: Timestamp

 ** ExcludeFilters **   
If this array of metric namespaces is present, then these namespaces are the only metric namespaces that are not streamed by this metric stream. In this case, all other metric namespaces in the account are streamed by this metric stream.  
Type: Array of [MetricStreamFilter](API_MetricStreamFilter.md) objects

 ** FirehoseArn **   
The ARN of the Amazon Kinesis Data Firehose delivery stream that is used by this metric stream.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.

 ** IncludeFilters **   
If this array of metric namespaces is present, then these namespaces are the only metric namespaces that are streamed by this metric stream.  
Type: Array of [MetricStreamFilter](API_MetricStreamFilter.md) objects

 ** IncludeLinkedAccountsMetrics **   
If this is `true` and this metric stream is in a monitoring account, then the stream includes metrics from source accounts that the monitoring account is linked to.  
Type: Boolean

 ** LastUpdateDate **   
The date of the most recent update to the metric stream's configuration.  
Type: Timestamp

 ** Name **   
The name of the metric stream.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.

 ** OutputFormat **   
The output format for the stream. Valid values are `json`, `opentelemetry1.0`, and `opentelemetry0.7`. For more information about metric stream output formats, see [Metric streams output formats](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-formats.html).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Valid Values: `json | opentelemetry0.7 | opentelemetry1.0` 

 ** RoleArn **   
The ARN of the IAM role that is used by this metric stream.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.

 ** State **   
The state of the metric stream. The possible values are `running` and `stopped`.  
Type: String

 ** StatisticsConfigurations **   
Each entry in this array displays information about one or more metrics that include additional statistics in the metric stream. For more information about the additional statistics, see [ CloudWatch statistics definitions](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html.html).   
Type: Array of [MetricStreamStatisticsConfiguration](API_MetricStreamStatisticsConfiguration.md) objects

## Errors
<a name="API_GetMetricStream_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterCombination **   
Parameters were used together that cannot be used together.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFoundException **   
The named resource does not exist.  
HTTP Status Code: 404

## See Also
<a name="API_GetMetricStream_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/GetMetricStream) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/GetMetricStream) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/GetMetricStream) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/GetMetricStream) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/GetMetricStream) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/GetMetricStream) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/GetMetricStream) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/GetMetricStream) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/GetMetricStream) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/GetMetricStream) 

# GetMetricWidgetImage
<a name="API_GetMetricWidgetImage"></a>

You can use the `GetMetricWidgetImage` API to retrieve a snapshot graph of one or more Amazon CloudWatch metrics as a bitmap image. You can then embed this image into your services and products, such as wiki pages, reports, and documents. You could also retrieve images regularly, such as every minute, and create your own custom live dashboard.

The graph you retrieve can include all CloudWatch metric graph features, including metric math and horizontal and vertical annotations.

There is a limit of 20 transactions per second for this API. Each `GetMetricWidgetImage` action has the following limits:
+ As many as 100 metrics in the graph.
+ Up to 100 KB uncompressed payload.

## Request Parameters
<a name="API_GetMetricWidgetImage_RequestParameters"></a>

 ** MetricWidget **   
A JSON string that defines the bitmap graph to be retrieved. The string includes the metrics to include in the graph, statistics, annotations, title, axis limits, and so on. You can include only one `MetricWidget` parameter in each `GetMetricWidgetImage` call.  
For more information about the syntax of `MetricWidget` see [GetMetricWidgetImage: Metric Widget Structure and Syntax](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/CloudWatch-Metric-Widget-Structure.html).  
If any metric on the graph could not load all the requested data points, an orange triangle with an exclamation point appears next to the graph legend.  
Type: String  
Required: Yes

 ** OutputFormat **   
The format of the resulting image. Only PNG images are supported.  
The default is `png`. If you specify `png`, the API returns an HTTP response with the content-type set to `text/xml`. The image data is in a `MetricWidgetImage` field. For example:  
 ` <GetMetricWidgetImageResponse xmlns=<URLstring>>`   
 ` <GetMetricWidgetImageResult>`   
 ` <MetricWidgetImage>`   
 ` iVBORw0KGgoAAAANSUhEUgAAAlgAAAGQEAYAAAAip...`   
 ` </MetricWidgetImage>`   
 ` </GetMetricWidgetImageResult>`   
 ` <ResponseMetadata>`   
 ` <RequestId>6f0d4192-4d42-11e8-82c1-f539a07e0e3b</RequestId>`   
 ` </ResponseMetadata>`   
 `</GetMetricWidgetImageResponse>`   
The `image/png` setting is intended only for custom HTTP requests. For most use cases, and all actions using an Amazon SDK, you should use `png`. If you specify `image/png`, the HTTP response has a content-type set to `image/png`, and the body of the response is a PNG image.  
Type: String  
Required: No

## Response Elements
<a name="API_GetMetricWidgetImage_ResponseElements"></a>

The following element is returned by the service.

 ** MetricWidgetImage **   
The image of the graph, in the output format specified. The output is base64-encoded.  
Type: Base64-encoded binary data object

## Errors
<a name="API_GetMetricWidgetImage_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

## Examples
<a name="API_GetMetricWidgetImage_Examples"></a>

### Example
<a name="API_GetMetricWidgetImage_Example_1"></a>

The following is an example of a `GetMetricWidgetImage` call. This example displays a graph showing an image of the `Average` statistic for the `CPUUtilization` metric for two Amazon EC2 instances, with both horizontal and vertical annotations.

```
{
   "OutputFormat":"png",
   "MetricWidget":"{\"width\":600,\"height\":395,\"metrics\":[[\"AWS/EC2\",\"CPUUtilization\",\"InstanceId\",\"i-1234567890abcdef0\",{\"stat\":\"Average\"}],[\"AWS/EC2\",\"CPUUtilization\",\"InstanceId\",\"i-0987654321abcdef0\",{\"stat\":\"Average\"}]],\"period\":300,\"start\":\"-P30D\",\"end\":\"PT0H\",\"stacked\":false,\"yAxis\":{\"left\":{\"min\":0.1,\"max\":1},\"right\":{\"min\":0}},\"title\":\"CPU for Two Instances\",\"annotations\":{\"horizontal\":[{\"color\":\"#ff6961\",\"label\":\"Trouble threshold start\",\"fill\":\"above\",\"value\":0.5}],\"vertical\":[{\"visible\":true,\"color\":\"#9467bd\",\"label\":\"Bug fix deployed\",\"value\":\"2018-08-28T15:25:26Z\",\"fill\":\"after\"}]}}"
}
```

## See Also
<a name="API_GetMetricWidgetImage_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/GetMetricWidgetImage) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/GetMetricWidgetImage) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/GetMetricWidgetImage) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/GetMetricWidgetImage) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/GetMetricWidgetImage) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/GetMetricWidgetImage) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/GetMetricWidgetImage) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/GetMetricWidgetImage) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/GetMetricWidgetImage) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/GetMetricWidgetImage) 

# GetOTelEnrichment
<a name="API_GetOTelEnrichment"></a>

Returns the current status of vended metric enrichment for the account, including whether CloudWatch vended metrics are enriched with resource ARN and resource tag labels and queryable using PromQL. For the list of supported resources, see [Supported Amazon infrastructure metrics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/UsingResourceTagsForTelemetry.html).

## Response Elements
<a name="API_GetOTelEnrichment_ResponseElements"></a>

The following element is returned by the service.

 ** Status **   
The status of OTel enrichment for the account. Valid values are `Running` (enrichment is enabled) and `Stopped` (enrichment is disabled).  
Type: String  
Valid Values: `Running | Stopped` 

## Errors
<a name="API_GetOTelEnrichment_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

## See Also
<a name="API_GetOTelEnrichment_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/GetOTelEnrichment) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/GetOTelEnrichment) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/GetOTelEnrichment) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/GetOTelEnrichment) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/GetOTelEnrichment) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/GetOTelEnrichment) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/GetOTelEnrichment) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/GetOTelEnrichment) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/GetOTelEnrichment) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/GetOTelEnrichment) 

# ListAlarmMuteRules
<a name="API_ListAlarmMuteRules"></a>

Lists alarm mute rules in your Amazon account and region.

You can filter the results by alarm name to find all mute rules targeting a specific alarm, or by status to find rules that are scheduled, active, or expired.

This operation supports pagination for accounts with many mute rules. Use the `MaxRecords` and `NextToken` parameters to retrieve results in multiple calls.

 **Permissions** 

To list mute rules, you need the `cloudwatch:ListAlarmMuteRules` permission.

## Request Parameters
<a name="API_ListAlarmMuteRules_RequestParameters"></a>

 ** AlarmName **   
Filter results to show only mute rules that target the specified alarm name.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** MaxRecords **   
The maximum number of mute rules to return in one call. The default is 50.  
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 100.  
Required: No

 ** NextToken **   
The token returned from a previous call to indicate where to continue retrieving results.  
Type: String  
Required: No

 ** Statuses **   
Filter results to show only mute rules with the specified statuses. Valid values are `SCHEDULED`, `ACTIVE`, or `EXPIRED`.  
Type: Array of strings  
Valid Values: `SCHEDULED | ACTIVE | EXPIRED`   
Required: No

## Response Elements
<a name="API_ListAlarmMuteRules_ResponseElements"></a>

The following elements are returned by the service.

 ** AlarmMuteRuleSummaries **   
A list of alarm mute rule summaries.  
Type: Array of [AlarmMuteRuleSummary](API_AlarmMuteRuleSummary.md) objects

 ** NextToken **   
The token to use when requesting the next set of results. If this field is absent, there are no more results to retrieve.  
Type: String

## Errors
<a name="API_ListAlarmMuteRules_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidNextToken **   
The next token specified is invalid.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFoundException **   
The named resource does not exist.  
HTTP Status Code: 404

## Examples
<a name="API_ListAlarmMuteRules_Examples"></a>

### List all mute rules
<a name="API_ListAlarmMuteRules_Example_1"></a>

List all alarm mute rules in your account.

#### Sample Request
<a name="API_ListAlarmMuteRules_Example_1_Request"></a>

```
aws cloudwatch list-alarm-mute-rules
```

#### Sample Response
<a name="API_ListAlarmMuteRules_Example_1_Response"></a>

```
{
    "AlarmMuteRuleSummaries": [
        {
            "Name": "DailyMaintenanceWindow",
            "AlarmMuteRuleArn": "arn:aws:cloudwatch:us-east-1:123456789012:alarm-mute-rule:DailyMaintenanceWindow",
            "Status": "SCHEDULED",
            "MuteType": "RECURRING",
            "LastUpdatedTimestamp": "2026-01-15T10:30:00Z"
        },
        {
            "Name": "ProductionDeployment-2026-01-20",
            "AlarmMuteRuleArn": "arn:aws:cloudwatch:us-east-1:123456789012:alarm-mute-rule:ProductionDeployment-2026-01-20",
            "Status": "ACTIVE",
            "MuteType": "ONE_TIME",
            "LastUpdatedTimestamp": "2026-01-20T13:00:00Z"
        },
        {
            "Name": "WeeklyBackupWindow",
            "AlarmMuteRuleArn": "arn:aws:cloudwatch:us-west-2:123456789012:alarm-mute-rule:WeeklyBackupWindow",
            "Status": "SCHEDULED",
            "MuteType": "RECURRING",
            "ExpireDate": "2026-12-31T23:59:59Z",
            "LastUpdatedTimestamp": "2026-01-05T12:00:00Z"
        }
    ]
}
```

### List mute rules targeting a specific alarm
<a name="API_ListAlarmMuteRules_Example_2"></a>

List all mute rules that target a specific alarm.

#### Sample Request
<a name="API_ListAlarmMuteRules_Example_2_Request"></a>

```
aws cloudwatch list-alarm-mute-rules \
	--alarm-name "WebServerCPUAlarm"
```

#### Sample Response
<a name="API_ListAlarmMuteRules_Example_2_Response"></a>

```
{
    "AlarmMuteRuleSummaries": [
        {
            "Name": "DailyMaintenanceWindow",
            "AlarmMuteRuleArn": "arn:aws:cloudwatch:us-east-1:123456789012:alarm-mute-rule:DailyMaintenanceWindow",
            "Status": "SCHEDULED",
            "MuteType": "RECURRING",
            "LastUpdatedTimestamp": "2026-01-15T10:30:00Z"
        },
        {
            "Name": "EmergencyMuteRule",
            "AlarmMuteRuleArn": "arn:aws:cloudwatch:us-east-1:123456789012:alarm-mute-rule:EmergencyMuteRule",
            "Status": "ACTIVE",
            "MuteType": "ONE_TIME",
            "LastUpdatedTimestamp": "2026-01-21T14:00:00Z"
        }
    ]
}
```

## See Also
<a name="API_ListAlarmMuteRules_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/ListAlarmMuteRules) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/ListAlarmMuteRules) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/ListAlarmMuteRules) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/ListAlarmMuteRules) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/ListAlarmMuteRules) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/ListAlarmMuteRules) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/ListAlarmMuteRules) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/ListAlarmMuteRules) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/ListAlarmMuteRules) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/ListAlarmMuteRules) 

# ListDashboards
<a name="API_ListDashboards"></a>

Returns a list of the dashboards for your account. If you include `DashboardNamePrefix`, only those dashboards with names starting with the prefix are listed. Otherwise, all dashboards in your account are listed. 

 `ListDashboards` returns up to 1000 results on one page. If there are more than 1000 dashboards, you can call `ListDashboards` again and include the value you received for `NextToken` in the first call, to receive the next 1000 results.

## Request Parameters
<a name="API_ListDashboards_RequestParameters"></a>

 ** DashboardNamePrefix **   
If you specify this parameter, only the dashboards with names starting with the specified string are listed. The maximum length is 255, and valid characters are A-Z, a-z, 0-9, ".", "-", and "\$1".   
Type: String  
Required: No

 ** NextToken **   
The token returned by a previous call to indicate that there is more data available.  
Type: String  
Required: No

## Response Elements
<a name="API_ListDashboards_ResponseElements"></a>

The following elements are returned by the service.

 ** DashboardEntries **   
The list of matching dashboards.  
Type: Array of [DashboardEntry](API_DashboardEntry.md) objects

 ** NextToken **   
The token that marks the start of the next batch of returned results.  
Type: String

## Errors
<a name="API_ListDashboards_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_ListDashboards_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/ListDashboards) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/ListDashboards) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/ListDashboards) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/ListDashboards) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/ListDashboards) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/ListDashboards) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/ListDashboards) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/ListDashboards) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/ListDashboards) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/ListDashboards) 

# ListManagedInsightRules
<a name="API_ListManagedInsightRules"></a>

 Returns a list that contains the number of managed Contributor Insights rules in your account. 

## Request Parameters
<a name="API_ListManagedInsightRules_RequestParameters"></a>

 ** MaxResults **   
 The maximum number of results to return in one operation. If you omit this parameter, the default number is used. The default number is `100`.   
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 500.  
Required: No

 ** NextToken **   
 Include this value to get the next set of rules if the value was returned by the previous operation.   
Type: String  
Required: No

 ** ResourceARN **   
 The ARN of an Amazon resource that has managed Contributor Insights rules.   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: Yes

## Response Elements
<a name="API_ListManagedInsightRules_ResponseElements"></a>

The following elements are returned by the service.

 ** ManagedRules **   
 The managed rules that are available for the specified Amazon resource.   
Type: Array of [ManagedRuleDescription](API_ManagedRuleDescription.md) objects

 ** NextToken **   
 Include this value to get the next set of rules if the value was returned by the previous operation.   
Type: String

## Errors
<a name="API_ListManagedInsightRules_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidNextToken **   
The next token specified is invalid.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_ListManagedInsightRules_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/ListManagedInsightRules) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/ListManagedInsightRules) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/ListManagedInsightRules) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/ListManagedInsightRules) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/ListManagedInsightRules) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/ListManagedInsightRules) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/ListManagedInsightRules) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/ListManagedInsightRules) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/ListManagedInsightRules) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/ListManagedInsightRules) 

# ListMetrics
<a name="API_ListMetrics"></a>

List the specified metrics. You can use the returned metrics with [GetMetricData](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) or [GetMetricStatistics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html) to get statistical data.

Up to 500 results are returned for any one call. To retrieve additional results, use the returned token with subsequent calls.

After you create a metric, allow up to 15 minutes for the metric to appear. To see metric statistics sooner, use [GetMetricData](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) or [GetMetricStatistics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html).

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view metrics from the linked source accounts. For more information, see [CloudWatch cross-account observability](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html).

 `ListMetrics` doesn't return information about metrics if those metrics haven't reported data in the past two weeks. To retrieve those metrics, use [GetMetricData](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) or [GetMetricStatistics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html).

## Request Parameters
<a name="API_ListMetrics_RequestParameters"></a>

 ** Dimensions **   
The dimensions to filter against. Only the dimension with names that match exactly will be returned. If you specify one dimension name and a metric has that dimension and also other dimensions, it will be returned.  
Type: Array of [DimensionFilter](API_DimensionFilter.md) objects  
Array Members: Maximum number of 10 items.  
Required: No

 ** IncludeLinkedAccounts **   
If you are using this operation in a monitoring account, specify `true` to include metrics from source accounts in the returned data.  
The default is `false`.  
Type: Boolean  
Required: No

 ** MetricName **   
The name of the metric to filter against. Only the metrics with names that match exactly will be returned.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** Namespace **   
The metric namespace to filter against. Only the namespace that matches exactly will be returned.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Pattern: `[^:].*`   
Required: No

 ** NextToken **   
The token returned by a previous call to indicate that there is more data available.  
Type: String  
Required: No

 ** OwningAccount **   
When you use this operation in a monitoring account, use this field to return metrics only from one source account. To do so, specify that source account ID in this field, and also specify `true` for `IncludeLinkedAccounts`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** RecentlyActive **   
To filter the results to show only metrics that have had data points published in the past three hours, specify this parameter with a value of `PT3H`. This is the only valid value for this parameter.  
The results that are returned are an approximation of the value you specify. There is a low probability that the returned results include metrics with last published data as much as 50 minutes more than the specified time interval.  
Type: String  
Valid Values: `PT3H`   
Required: No

## Response Elements
<a name="API_ListMetrics_ResponseElements"></a>

The following elements are returned by the service.

 ** Metrics **   
The metrics that match your request.   
Type: Array of [Metric](API_Metric.md) objects

 ** NextToken **   
The token that marks the start of the next batch of returned results.   
Type: String

 ** OwningAccounts **   
If you are using this operation in a monitoring account, this array contains the account IDs of the source accounts where the metrics in the returned data are from.  
This field is a 1:1 mapping between each metric that is returned and the ID of the owning account.  
Type: Array of strings  
Length Constraints: Minimum length of 1. Maximum length of 255.

## Errors
<a name="API_ListMetrics_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

## Examples
<a name="API_ListMetrics_Examples"></a>

### List metrics in a specified namespace from all source accounts and from the monitoring account
<a name="API_ListMetrics_Example_1"></a>

The following example lists metrics in the `AWS/EC2` namespace from the monitoring account itself and all source accounts.

#### Sample Request
<a name="API_ListMetrics_Example_1_Request"></a>

```
{
  "IncludeLinkedAccounts": true,
  "Namespace" : "AWS/EC2"
}
```

### List metrics from a namespace in just one source account
<a name="API_ListMetrics_Example_2"></a>

The following example lists metrics in the `AWS/EC2` namespace from only the source account with the ID `111111111111`.

#### Sample Request
<a name="API_ListMetrics_Example_2_Request"></a>

```
{
  "IncludeLinkedAccounts": "true",
  "OwningAccount" : "111111111111",
  "Namespace" : "AWS/EC2"
}
```

## See Also
<a name="API_ListMetrics_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/ListMetrics) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/ListMetrics) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/ListMetrics) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/ListMetrics) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/ListMetrics) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/ListMetrics) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/ListMetrics) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/ListMetrics) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/ListMetrics) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/ListMetrics) 

# ListMetricStreams
<a name="API_ListMetricStreams"></a>

Returns a list of metric streams in this account.

## Request Parameters
<a name="API_ListMetricStreams_RequestParameters"></a>

 ** MaxResults **   
The maximum number of results to return in one operation.  
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 500.  
Required: No

 ** NextToken **   
Include this value, if it was returned by the previous call, to get the next set of metric streams.  
Type: String  
Required: No

## Response Elements
<a name="API_ListMetricStreams_ResponseElements"></a>

The following elements are returned by the service.

 ** Entries **   
The array of metric stream information.  
Type: Array of [MetricStreamEntry](API_MetricStreamEntry.md) objects

 ** NextToken **   
The token that marks the start of the next batch of returned results. You can use this token in a subsequent operation to get the next batch of results.  
Type: String

## Errors
<a name="API_ListMetricStreams_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidNextToken **   
The next token specified is invalid.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_ListMetricStreams_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/ListMetricStreams) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/ListMetricStreams) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/ListMetricStreams) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/ListMetricStreams) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/ListMetricStreams) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/ListMetricStreams) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/ListMetricStreams) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/ListMetricStreams) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/ListMetricStreams) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/ListMetricStreams) 

# ListTagsForResource
<a name="API_ListTagsForResource"></a>

Displays the tags associated with a CloudWatch resource. Currently, alarms and Contributor Insights rules support tagging.

## Request Parameters
<a name="API_ListTagsForResource_RequestParameters"></a>

 ** ResourceARN **   
The ARN of the CloudWatch resource that you want to view tags for.  
The ARN format of an alarm is `arn:aws:cloudwatch:Region:account-id:alarm:alarm-name `   
The ARN format of a Contributor Insights rule is `arn:aws:cloudwatch:Region:account-id:insight-rule/insight-rule-name `   
For more information about ARN format, see [ Resource Types Defined by Amazon CloudWatch](https://docs.amazonaws.cn/IAM/latest/UserGuide/list_amazoncloudwatch.html#amazoncloudwatch-resources-for-iam-policies) in the *Amazon Web Services General Reference*.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: Yes

## Response Elements
<a name="API_ListTagsForResource_ResponseElements"></a>

The following element is returned by the service.

 ** Tags **   
The list of tag keys and values associated with the resource you specified.  
Type: Array of [Tag](API_Tag.md) objects

## Errors
<a name="API_ListTagsForResource_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFoundException **   
The named resource does not exist.  
HTTP Status Code: 404

## See Also
<a name="API_ListTagsForResource_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/ListTagsForResource) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/ListTagsForResource) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/ListTagsForResource) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/ListTagsForResource) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/ListTagsForResource) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/ListTagsForResource) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/ListTagsForResource) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/ListTagsForResource) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/ListTagsForResource) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/ListTagsForResource) 

# PutAlarmMuteRule
<a name="API_PutAlarmMuteRule"></a>

Creates or updates an alarm mute rule.

Alarm mute rules automatically mute alarm actions during predefined time windows. When a mute rule is active, targeted alarms continue to evaluate metrics and transition between states, but their configured actions (such as Amazon SNS notifications or Auto Scaling actions) are muted.

You can create mute rules with recurring schedules using `cron` expressions or one-time mute windows using `at` expressions. Each mute rule can target up to 100 specific alarms by name.

If you specify a rule name that already exists, this operation updates the existing rule with the new configuration.

 **Permissions** 

To create or update a mute rule, you must have the `cloudwatch:PutAlarmMuteRule` permission on two types of resources: the alarm mute rule resource itself, and each alarm that the rule targets.

For example, If you want to allow a user to create mute rules that target only specific alarms named "WebServerCPUAlarm" and "DatabaseConnectionAlarm", you would create an IAM policy with one statement granting `cloudwatch:PutAlarmMuteRule` on the alarm mute rule resource (`arn:aws:cloudwatch:[REGION]:123456789012:alarm-mute-rule:*`), and another statement granting `cloudwatch:PutAlarmMuteRule` on the targeted alarm resources (`arn:aws:cloudwatch:[REGION]:123456789012:alarm:WebServerCPUAlarm` and `arn:aws:cloudwatch:[REGION]:123456789012:alarm:DatabaseConnectionAlarm`).

You can also use IAM policy conditions to allow targeting alarms based on resource tags. For example, you can restrict users to create/update mute rules to only target alarms that have a specific tag key-value pair, such as `Team=TeamA`.

## Request Parameters
<a name="API_PutAlarmMuteRule_RequestParameters"></a>

 ** Description **   
A description of the alarm mute rule that helps you identify its purpose.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1024.  
Required: No

 ** ExpireDate **   
The date and time when the mute rule expires and is no longer evaluated, specified as a timestamp in ISO 8601 format (for example, `2026-12-31T23:59:59Z`). After this time, the rule status becomes EXPIRED and will no longer mute the targeted alarms.  
Type: Timestamp  
Required: No

 ** MuteTargets **   
Specifies which alarms this rule applies to.  
Type: [MuteTargets](API_MuteTargets.md) object  
Required: No

 ** Name **   
The name of the alarm mute rule. This name must be unique within your Amazon account and region.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

 ** Rule **   
The configuration that defines when and how long alarms should be muted.  
Type: [Rule](API_Rule.md) object  
Required: Yes

 ** StartDate **   
The date and time after which the mute rule takes effect, specified as a timestamp in ISO 8601 format (for example, `2026-04-15T08:00:00Z`). If not specified, the mute rule takes effect immediately upon creation and the mutes are applied as per the schedule expression.  
Type: Timestamp  
Required: No

 ** Tags **   
A list of key-value pairs to associate with the alarm mute rule. You can use tags to categorize and manage your mute rules.  
Type: Array of [Tag](API_Tag.md) objects  
Required: No

## Errors
<a name="API_PutAlarmMuteRule_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** LimitExceeded **   
The quota for alarms for this customer has already been reached.    
 ** message **   

HTTP Status Code: 400

## Examples
<a name="API_PutAlarmMuteRule_Examples"></a>

### Create a recurring daily mute rule
<a name="API_PutAlarmMuteRule_Example_1"></a>

Create a mute rule that mutes specific alarms every day from 2:00 AM to 4:00 AM UTC.

#### Sample Request
<a name="API_PutAlarmMuteRule_Example_1_Request"></a>

```
aws cloudwatch put-alarm-mute-rule \
    --name "DailyMaintenanceWindow" \
    --description "Mute alarms during daily maintenance" \
    --rule '{
    "Schedule": {
        "Expression": "cron(0 2 * * ?)",
        "Duration": "PT2H",
        "Timezone": "UTC"
        }
    }' \
    --mute-targets '{
        "AlarmNames": ["WebServerCPUAlarm", "DatabaseConnectionAlarm"]
    }'
```

### Create a one-time mute rule
<a name="API_PutAlarmMuteRule_Example_2"></a>

Create a mute rule for a one-time deployment window.

#### Sample Request
<a name="API_PutAlarmMuteRule_Example_2_Request"></a>

```
aws cloudwatch put-alarm-mute-rule \
    --name "ProductionDeployment-2026-01-20" \
    --description "Mute alarms during production deployment" \
    --rule '{
    "Schedule": {
    "Expression": "at(2026-01-20T14:00)",
    "Duration": "PT1H",
    "Timezone": "America/New_York"
        }
    }' \
    --mute-targets '{
        "AlarmNames": ["APILatencyAlarm", "ErrorRateAlarm"]
    }'
```

### Create a weekly mute rule with tags
<a name="API_PutAlarmMuteRule_Example_3"></a>

Create a mute rule that mutes specific alarms every Saturday for 4 hours.

#### Sample Request
<a name="API_PutAlarmMuteRule_Example_3_Request"></a>

```
aws cloudwatch put-alarm-mute-rule \
    --name "WeeklyBackupWindow" \
    --description "Mute alarms during weekly backup" \
    --rule '{
        "Schedule": {
            "Expression": "cron(0 0 ? * SAT)",
            "Duration": "PT4H",
            "Timezone": "America/Los_Angeles"
        }
    }' \
    --mute-targets '{
        "AlarmNames": ["BackupAlarm", "StorageAlarm"]
    }' \
    --tags '[
        {"Key": "Environment", "Value": "Production"},
        {"Key": "Team", "Value": "Operations"}
    ]'
```

## See Also
<a name="API_PutAlarmMuteRule_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/PutAlarmMuteRule) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/PutAlarmMuteRule) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/PutAlarmMuteRule) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/PutAlarmMuteRule) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/PutAlarmMuteRule) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/PutAlarmMuteRule) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/PutAlarmMuteRule) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/PutAlarmMuteRule) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/PutAlarmMuteRule) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/PutAlarmMuteRule) 

# PutAnomalyDetector
<a name="API_PutAnomalyDetector"></a>

Creates an anomaly detection model for a CloudWatch metric. You can use the model to display a band of expected normal values when the metric is graphed.

If you have enabled unified cross-account observability, and this account is a monitoring account, the metric can be in the same account or a source account. You can specify the account ID in the object you specify in the `SingleMetricAnomalyDetector` parameter.

For more information, see [CloudWatch Anomaly Detection](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch_Anomaly_Detection.html).

## Request Parameters
<a name="API_PutAnomalyDetector_RequestParameters"></a>

 ** Configuration **   
The configuration specifies details about how the anomaly detection model is to be trained, including time ranges to exclude when training and updating the model. You can specify as many as 10 time ranges.  
The configuration can also include the time zone to use for the metric.  
Type: [AnomalyDetectorConfiguration](API_AnomalyDetectorConfiguration.md) object  
Required: No

 ** Dimensions **   
 *This parameter has been deprecated.*   
The metric dimensions to create the anomaly detection model for.  
Type: Array of [Dimension](API_Dimension.md) objects  
Array Members: Maximum number of 30 items.  
Required: No

 ** MetricCharacteristics **   
Use this object to include parameters to provide information about your metric to CloudWatch to help it build more accurate anomaly detection models. Currently, it includes the `PeriodicSpikes` parameter.  
Type: [MetricCharacteristics](API_MetricCharacteristics.md) object  
Required: No

 ** MetricMathAnomalyDetector **   
The metric math anomaly detector to be created.  
When using `MetricMathAnomalyDetector`, you cannot include the following parameters in the same operation:  
+  `Dimensions` 
+  `MetricName` 
+  `Namespace` 
+  `Stat` 
+ the `SingleMetricAnomalyDetector` parameters of `PutAnomalyDetectorInput` 
Instead, specify the metric math anomaly detector attributes as part of the property `MetricMathAnomalyDetector`.  
Type: [MetricMathAnomalyDetector](API_MetricMathAnomalyDetector.md) object  
Required: No

 ** MetricName **   
 *This parameter has been deprecated.*   
The name of the metric to create the anomaly detection model for.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** Namespace **   
 *This parameter has been deprecated.*   
The namespace of the metric to create the anomaly detection model for.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Pattern: `[^:].*`   
Required: No

 ** SingleMetricAnomalyDetector **   
A single metric anomaly detector to be created.  
When using `SingleMetricAnomalyDetector`, you cannot include the following parameters in the same operation:  
+  `Dimensions` 
+  `MetricName` 
+  `Namespace` 
+  `Stat` 
+ the `MetricMathAnomalyDetector` parameters of `PutAnomalyDetectorInput` 
Instead, specify the single metric anomaly detector attributes as part of the property `SingleMetricAnomalyDetector`.  
Type: [SingleMetricAnomalyDetector](API_SingleMetricAnomalyDetector.md) object  
Required: No

 ** Stat **   
 *This parameter has been deprecated.*   
The statistic to use for the metric and the anomaly detection model.  
Type: String  
Length Constraints: Maximum length of 50.  
Pattern: `(SampleCount|Average|Sum|Minimum|Maximum|IQM|(p|tc|tm|ts|wm)(\d{1,2}(\.\d{0,10})?|100)|[ou]\d+(\.\d*)?)(_E|_L|_H)?|(TM|TC|TS|WM)\(((((\d{1,2})(\.\d{0,10})?|100(\.0{0,10})?)%)?:((\d{1,2})(\.\d{0,10})?|100(\.0{0,10})?)%|((\d{1,2})(\.\d{0,10})?|100(\.0{0,10})?)%:(((\d{1,2})(\.\d{0,10})?|100(\.0{0,10})?)%)?)\)|(TM|TC|TS|WM|PR)\(((\d+(\.\d{0,10})?|(\d+(\.\d{0,10})?[Ee][+-]?\d+)):((\d+(\.\d{0,10})?|(\d+(\.\d{0,10})?[Ee][+-]?\d+)))?|((\d+(\.\d{0,10})?|(\d+(\.\d{0,10})?[Ee][+-]?\d+)))?:(\d+(\.\d{0,10})?|(\d+(\.\d{0,10})?[Ee][+-]?\d+)))\)`   
Required: No

## Errors
<a name="API_PutAnomalyDetector_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterCombination **   
Parameters were used together that cannot be used together.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** LimitExceededException **   
The operation exceeded one or more limits.  
HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_PutAnomalyDetector_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/PutAnomalyDetector) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/PutAnomalyDetector) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/PutAnomalyDetector) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/PutAnomalyDetector) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/PutAnomalyDetector) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/PutAnomalyDetector) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/PutAnomalyDetector) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/PutAnomalyDetector) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/PutAnomalyDetector) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/PutAnomalyDetector) 

# PutCompositeAlarm
<a name="API_PutCompositeAlarm"></a>

Creates or updates a *composite alarm*. When you create a composite alarm, you specify a rule expression for the alarm that takes into account the alarm states of other alarms that you have created. The composite alarm goes into ALARM state only if all conditions of the rule are met.

The alarms specified in a composite alarm's rule expression can include metric alarms and other composite alarms. The rule expression of a composite alarm can include as many as 100 underlying alarms. Any single alarm can be included in the rule expressions of as many as 150 composite alarms.

Using composite alarms can reduce alarm noise. You can create multiple metric alarms, and also create a composite alarm and set up alerts only for the composite alarm. For example, you could create a composite alarm that goes into ALARM state only when more than one of the underlying metric alarms are in ALARM state.

Composite alarms can take the following actions:
+ Notify Amazon SNS topics.
+ Invoke Lambda functions.
+ Create OpsItems in Systems Manager Ops Center.
+ Create incidents in Systems Manager Incident Manager.

**Note**  
It is possible to create a loop or cycle of composite alarms, where composite alarm A depends on composite alarm B, and composite alarm B also depends on composite alarm A. In this scenario, you can't delete any composite alarm that is part of the cycle because there is always still a composite alarm that depends on that alarm that you want to delete.  
To get out of such a situation, you must break the cycle by changing the rule of one of the composite alarms in the cycle to remove a dependency that creates the cycle. The simplest change to make to break a cycle is to change the `AlarmRule` of one of the alarms to `false`.   
Additionally, the evaluation of composite alarms stops if CloudWatch detects a cycle in the evaluation path. 

When this operation creates an alarm, the alarm state is immediately set to `INSUFFICIENT_DATA`. The alarm is then evaluated and its state is set appropriately. Any actions associated with the new state are then executed. For a composite alarm, this initial time after creation is the only time that the alarm can be in `INSUFFICIENT_DATA` state.

When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.

To use this operation, you must be signed on with the `cloudwatch:PutCompositeAlarm` permission that is scoped to `*`. You can't create a composite alarms if your `cloudwatch:PutCompositeAlarm` permission has a narrower scope.

If you are an IAM user, you must have `iam:CreateServiceLinkedRole` to create a composite alarm that has Systems Manager OpsItem actions.

## Request Parameters
<a name="API_PutCompositeAlarm_RequestParameters"></a>

 ** ActionsEnabled **   
Indicates whether actions should be executed during any changes to the alarm state of the composite alarm. The default is `TRUE`.  
Type: Boolean  
Required: No

 ** ActionsSuppressor **   
 Actions will be suppressed if the suppressor alarm is in the `ALARM` state. `ActionsSuppressor` can be an AlarmName or an Amazon Resource Name (ARN) from an existing alarm.   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1600.  
Required: No

 ** ActionsSuppressorExtensionPeriod **   
 The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of the `ALARM` state. After this time, the composite alarm performs its actions.   
 `ExtensionPeriod` is required only when `ActionsSuppressor` is specified. 
Type: Integer  
Required: No

 ** ActionsSuppressorWaitPeriod **   
 The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into the `ALARM` state. After this time, the composite alarm performs its actions.   
 `WaitPeriod` is required only when `ActionsSuppressor` is specified. 
Type: Integer  
Required: No

 ** AlarmActions **   
The actions to execute when this alarm transitions to the `ALARM` state from any other state. Each action is specified as an Amazon Resource Name (ARN).  
Valid Values: ]  
 **Amazon SNS actions:**   
 `arn:aws:sns:region:account-id:sns-topic-name `   
 **Lambda actions:**   
+ Invoke the latest version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name ` 
+ Invoke a specific version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name:version-number ` 
+ Invoke a function by using an alias Lambda function: `arn:aws:lambda:region:account-id:function:function-name:alias-name ` 
 **Systems Manager actions:**   
 `arn:aws:ssm:region:account-id:opsitem:severity `   
 **Start a Amazon Q Developer operational investigation**   
 `arn:aws:aiops:region:account-id:investigation-group:investigation-group-id `   
Type: Array of strings  
Array Members: Maximum number of 5 items.  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: No

 ** AlarmDescription **   
The description for the composite alarm.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1024.  
Required: No

 ** AlarmName **   
The name for the composite alarm. This name must be unique within the Region.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

 ** AlarmRule **   
An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state. For each alarm that you reference, you designate a function that specifies whether that alarm needs to be in ALARM state, OK state, or INSUFFICIENT\$1DATA state. You can use operators (AND, OR and NOT) to combine multiple functions in a single expression. You can use parenthesis to logically group the functions in your expression.  
You can use either alarm names or ARNs to reference the other alarms that are to be evaluated.  
Functions can include the following:  
+  `ALARM("alarm-name or alarm-ARN")` is TRUE if the named alarm is in ALARM state.
+  `OK("alarm-name or alarm-ARN")` is TRUE if the named alarm is in OK state.
+  `INSUFFICIENT_DATA("alarm-name or alarm-ARN")` is TRUE if the named alarm is in INSUFFICIENT\$1DATA state.
+  `TRUE` always evaluates to TRUE.
+  `FALSE` always evaluates to FALSE.
TRUE and FALSE are useful for testing a complex `AlarmRule` structure, and for testing your alarm actions.  
Alarm names specified in `AlarmRule` can be surrounded with double-quotes ("), but do not have to be.  
The following are some examples of `AlarmRule`:  
+  `ALARM(CPUUtilizationTooHigh) AND ALARM(DiskReadOpsTooHigh)` specifies that the composite alarm goes into ALARM state only if both CPUUtilizationTooHigh and DiskReadOpsTooHigh alarms are in ALARM state.
+  `ALARM(CPUUtilizationTooHigh) AND NOT ALARM(DeploymentInProgress)` specifies that the alarm goes to ALARM state if CPUUtilizationTooHigh is in ALARM state and DeploymentInProgress is not in ALARM state. This example reduces alarm noise during a known deployment window.
+  `(ALARM(CPUUtilizationTooHigh) OR ALARM(DiskReadOpsTooHigh)) AND OK(NetworkOutTooHigh)` goes into ALARM state if CPUUtilizationTooHigh OR DiskReadOpsTooHigh is in ALARM state, and if NetworkOutTooHigh is in OK state. This provides another example of using a composite alarm to prevent noise. This rule ensures that you are not notified with an alarm action on high CPU or disk usage if a known network problem is also occurring.
The `AlarmRule` can specify as many as 100 "children" alarms. The `AlarmRule` expression can have as many as 500 elements. Elements are child alarms, TRUE or FALSE statements, and parentheses.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 10240.  
Required: Yes

 ** InsufficientDataActions **   
The actions to execute when this alarm transitions to the `INSUFFICIENT_DATA` state from any other state. Each action is specified as an Amazon Resource Name (ARN).  
Valid Values: ]  
 **Amazon SNS actions:**   
 `arn:aws:sns:region:account-id:sns-topic-name `   
 **Lambda actions:**   
+ Invoke the latest version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name ` 
+ Invoke a specific version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name:version-number ` 
+ Invoke a function by using an alias Lambda function: `arn:aws:lambda:region:account-id:function:function-name:alias-name ` 
Type: Array of strings  
Array Members: Maximum number of 5 items.  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: No

 ** OKActions **   
The actions to execute when this alarm transitions to an `OK` state from any other state. Each action is specified as an Amazon Resource Name (ARN).  
Valid Values: ]  
 **Amazon SNS actions:**   
 `arn:aws:sns:region:account-id:sns-topic-name `   
 **Lambda actions:**   
+ Invoke the latest version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name ` 
+ Invoke a specific version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name:version-number ` 
+ Invoke a function by using an alias Lambda function: `arn:aws:lambda:region:account-id:function:function-name:alias-name ` 
Type: Array of strings  
Array Members: Maximum number of 5 items.  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: No

 ** Tags **   
A list of key-value pairs to associate with the alarm. You can associate as many as 50 tags with an alarm. To be able to associate tags with the alarm when you create the alarm, you must have the `cloudwatch:TagResource` permission.  
Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.  
If you are using this operation to update an existing alarm, any tags you specify in this parameter are ignored. To change the tags of an existing alarm, use [TagResource](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_TagResource.html) or [UntagResource](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_UntagResource.html).  
Type: Array of [Tag](API_Tag.md) objects  
Required: No

## Errors
<a name="API_PutCompositeAlarm_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** LimitExceeded **   
The quota for alarms for this customer has already been reached.    
 ** message **   

HTTP Status Code: 400

## Examples
<a name="API_PutCompositeAlarm_Examples"></a>

### Composite alarm example
<a name="API_PutCompositeAlarm_Example_1"></a>

The following example creates an alarm that notifies an SNS group when either of two specified metric alarms exceeds its threshold.

#### Sample Request
<a name="API_PutCompositeAlarm_Example_1_Request"></a>

```
{
    "AlarmDescription": "The host is experiencing problems",
    "AlarmRule": "ALARM(CPUUtilizationTooHigh) OR ALARM(DiskReadOpsTooHigh)",
    "AlarmName": "overall-health-alarm",
    "AlarmActions": [
        "arn:aws:sns:us-west-1:123456789012:my_sns_topic"
    ]
}
```

## See Also
<a name="API_PutCompositeAlarm_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/PutCompositeAlarm) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/PutCompositeAlarm) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/PutCompositeAlarm) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/PutCompositeAlarm) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/PutCompositeAlarm) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/PutCompositeAlarm) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/PutCompositeAlarm) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/PutCompositeAlarm) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/PutCompositeAlarm) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/PutCompositeAlarm) 

# PutDashboard
<a name="API_PutDashboard"></a>

Creates a dashboard if it does not already exist, or updates an existing dashboard. If you update a dashboard, the entire contents are replaced with what you specify here.

All dashboards in your account are global, not region-specific.

A simple way to create a dashboard using `PutDashboard` is to copy an existing dashboard. To copy an existing dashboard using the console, you can load the dashboard and then use the View/edit source command in the Actions menu to display the JSON block for that dashboard. Another way to copy a dashboard is to use `GetDashboard`, and then use the data returned within `DashboardBody` as the template for the new dashboard when you call `PutDashboard`.

When you create a dashboard with `PutDashboard`, a good practice is to add a text widget at the top of the dashboard with a message that the dashboard was created by script and should not be changed in the console. This message could also point console users to the location of the `DashboardBody` script or the CloudFormation template used to create the dashboard.

## Request Parameters
<a name="API_PutDashboard_RequestParameters"></a>

 ** DashboardBody **   
The detailed information about the dashboard in JSON format, including the widgets to include and their location on the dashboard. This parameter is required.  
For more information about the syntax, see [Dashboard Body Structure and Syntax](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html).  
Type: String  
Required: Yes

 ** DashboardName **   
The name of the dashboard. If a dashboard with this name already exists, this call modifies that dashboard, replacing its current contents. Otherwise, a new dashboard is created. The maximum length is 255, and valid characters are A-Z, a-z, 0-9, "-", and "\$1". This parameter is required.  
Type: String  
Required: Yes

## Response Elements
<a name="API_PutDashboard_ResponseElements"></a>

The following element is returned by the service.

 ** DashboardValidationMessages **   
If the input for `PutDashboard` was correct and the dashboard was successfully created or modified, this result is empty.  
If this result includes only warning messages, then the input was valid enough for the dashboard to be created or modified, but some elements of the dashboard might not render.  
If this result includes error messages, the input was not valid and the operation failed.  
Type: Array of [DashboardValidationMessage](API_DashboardValidationMessage.md) objects

## Errors
<a name="API_PutDashboard_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ConflictException **   
This operation attempted to create a resource that already exists.  
HTTP Status Code: 409

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterInput **   
Some part of the dashboard data is invalid.  
HTTP Status Code: 400

## Examples
<a name="API_PutDashboard_Examples"></a>

### Example
<a name="API_PutDashboard_Example_1"></a>

The following example creates a dashboard with just one text widget.

```
{
"DashboardName":"Dashboard-with-only-one-text-widget",
"DashboardBody":{
   "widgets":[
      {
         "type":"text",
         "x":0,
         "y":7,
         "width":3,
         "height":3,
         "properties":{
            "markdown":"Hello world"
         }
      }
   ]
}
}
```

### Example
<a name="API_PutDashboard_Example_2"></a>

The following example modifies an existing dashboard to include one metric widget and one text widget.

```
{
    "DashboardName": "Two-Widget-Dashboard",
    "DashboardBody": {
        "widgets": [
            {
                "type": "metric",
                "x": 0,
                "y": 0,
                "width": 12,
                "height": 6,
                "properties": {
                    "metrics": [
                        [
                            "AWS/EC2",
                            "CPUUtilization",
                            "InstanceId",
                            "i-012345"
                        ]
                    ],
                    "period": 300,
                    "stat": "Average",
                    "region": "us-east-1",
                    "title": "EC2 Instance CPU"
                }
            },
            {
                "type": "text",
                "x": 0,
                "y": 7,
                "width": 3,
                "height": 3,
                "properties": {
                    "markdown": "Hello world"
                }
            }
        ]
    }
}
```

### Example
<a name="API_PutDashboard_Example_3"></a>

The following example creates a dashboard with two metric widgets, side by side.

```
{
    "DashboardName": "Two-metric-widget-Dashboard",
    "DashboardBody": {
        "widgets": [
            {
                "type": "metric",
                "x": 0,
                "y": 0,
                "width": 12,
                "height": 6,
                "properties": {
                    "metrics": [
                        [
                            "AWS/EC2",
                            "CPUUtilization",
                            "InstanceId",
                            "i-012345"
                        ]
                    ],
                    "period": 300,
                    "stat": "Average",
                    "region": "us-east-1",
                    "title": "EC2 Instance CPU"
                }
            },
            {
                "type": "metric",
                "x": 12,
                "y": 0,
                "width": 12,
                "height": 6,
                "properties": {
                    "metrics": [
                        [
                            "AWS/S3",
                            "BucketSizeBytes",
                            "BucketName",
                            "amzn-s3-demo-bucket"
                        ]
                    ],
                    "period": 86400,
                    "stat": "Maximum",
                    "region": "us-east-1",
                    "title": "amzn-s3-demo-bucket bytes"
                }
            }
        ]
    }
}
```

### Example
<a name="API_PutDashboard_Example_4"></a>

The following example creates a dashboard with one widget at the top that shows the `DiskReadBytes` metric for three EC2 instances on one graph, and a separate widget below that, with an alarm.

```
{
    "DashboardName": "Dashboard-with-three-metric-graph-and-alarm",
    "DashboardBody": {
        "widgets": [
            {
                "type": "metric",
                "x": 0,
                "y": 0,
                "width": 12,
                "height": 6,
                "properties": {
                    "metrics": [
                        [
                            "AWS/EC2",
                            "DiskReadBytes",
                            "InstanceId",
                            "i-xyz"
                        ],
                        [
                            ".",
                            ".",
                            ".",
                            "i-abc"
                        ],
                        [
                            ".",
                            ".",
                            ".",
                            "i-123"
                        ]
                    ],
                    "period": 300,
                    "stat": "Average",
                    "region": "us-east-1",
                    "title": "EC2 Instance CPU"
                }
            },
            {
                "type": "metric",
                "x": 0,
                "y": 7,
                "width": 12,
                "height": 12,
                "properties": {
                    "annotations": {
                        "alarms": [
                            "arn:aws:cloudwatch:us-east-1:123456789012:alarm:myalarm"
                        ]
                    },
                    "period": 60,
                    "title": "MyAlarm"
                }
            }
        ]
    }
}
```

### Example
<a name="API_PutDashboard_Example_5"></a>

The following example creates a dashboard with one metric widget and one metric math widget.

```
{
   "DashboardName":"One-metric-math-widget-and-One-metric-widget",
   "DashboardBody":{
      "widgets":[
         {
            "type":"metric",
            "x":0,
            "y":0,
            "width":6,
            "height":6,
            "properties":{
               "metrics":[
                  [
                     "AWS/EC2",
                     "CPUUtilization",
                     "InstanceId",
                     "i-012345"
                  ]
               ],
               "region":"us-east-1",
               "stat":"Average",
               "period":300,
               "title":"EC2 Instance CPU"
            }
         },
         {
            "type":"metric",
            "x":6,
            "y":0,
            "width":6,
            "height":6,
            "properties":{
               "metrics":[
                  [
                     {
                        "expression":"SUM(METRICS())",
                        "label":"Expression1",
                        "id":"e1",
                        "visible":true
                     }
                  ],
                  [
                     "AWS/EC2",
                     "CPUUtilization",
                     "InstanceId",
                     "i-xyz",
                     {
                        "id":"m1",
                        "visible":true
                     }
                  ],
                  [
                     "...",
                     "i-abc",
                     {
                        "id":"m2",
                        "visible":true
                     }
                  ],
                  [
                     "...",
                     "i-123",
                     {
                        "id":"m3",
                        "visible":true
                     }
                  ],
                  [
                     "...",
                     "i-456",
                     {
                        "id":"m4",
                        "visible":true
                     }
                  ]
               ],
               "region":"us-east-1",
               "stat":"Average",
               "period":300,
               "title":"Sum of CPUUtilization of four Instances"
            }
         }
      ]
   }
}
```

## See Also
<a name="API_PutDashboard_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/PutDashboard) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/PutDashboard) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/PutDashboard) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/PutDashboard) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/PutDashboard) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/PutDashboard) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/PutDashboard) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/PutDashboard) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/PutDashboard) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/PutDashboard) 

# PutInsightRule
<a name="API_PutInsightRule"></a>

Creates a Contributor Insights rule. Rules evaluate log events in a CloudWatch Logs log group, enabling you to find contributor data for the log events in that log group. For more information, see [Using Contributor Insights to Analyze High-Cardinality Data](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/ContributorInsights.html).

If you create a rule, delete it, and then re-create it with the same name, historical data from the first time the rule was created might not be available.

## Request Parameters
<a name="API_PutInsightRule_RequestParameters"></a>

 ** ApplyOnTransformedLogs **   
Specify `true` to have this rule evaluate log events after they have been transformed by [Log transformation](https://docs.amazonaws.cn/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation.html). If you specify `true`, then the log events in log groups that have transformers will be evaluated by Contributor Insights after being transformed. Log groups that don't have transformers will still have their original log events evaluated by Contributor Insights.  
The default is `false`   
If a log group has a transformer, and transformation fails for some log events, those log events won't be evaluated by Contributor Insights. For information about investigating log transformation failures, see [Transformation metrics and errors](https://docs.amazonaws.cn/AmazonCloudWatch/latest/logs/Transformation-Errors-Metrics.html).
Type: Boolean  
Required: No

 ** RuleDefinition **   
The definition of the rule, as a JSON object. For details on the valid syntax, see [Contributor Insights Rule Syntax](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/ContributorInsights-RuleSyntax.html).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 8192.  
Pattern: `[\x00-\x7F]+`   
Required: Yes

 ** RuleName **   
A unique name for the rule.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[\x20-\x7E]+`   
Required: Yes

 ** RuleState **   
The state of the rule. Valid values are ENABLED and DISABLED.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 32.  
Pattern: `[\x20-\x7E]+`   
Required: No

 ** Tags **   
A list of key-value pairs to associate with the Contributor Insights rule. You can associate as many as 50 tags with a rule.  
Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only the resources that have certain tag values.  
To be able to associate tags with a rule, you must have the `cloudwatch:TagResource` permission in addition to the `cloudwatch:PutInsightRule` permission.  
If you are using this operation to update an existing Contributor Insights rule, any tags you specify in this parameter are ignored. To change the tags of an existing rule, use [TagResource](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_TagResource.html).  
Type: Array of [Tag](API_Tag.md) objects  
Required: No

## Errors
<a name="API_PutInsightRule_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** LimitExceededException **   
The operation exceeded one or more limits.  
HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_PutInsightRule_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/PutInsightRule) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/PutInsightRule) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/PutInsightRule) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/PutInsightRule) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/PutInsightRule) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/PutInsightRule) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/PutInsightRule) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/PutInsightRule) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/PutInsightRule) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/PutInsightRule) 

# PutManagedInsightRules
<a name="API_PutManagedInsightRules"></a>

 Creates a managed Contributor Insights rule for a specified Amazon resource. When you enable a managed rule, you create a Contributor Insights rule that collects data from Amazon services. You cannot edit these rules with `PutInsightRule`. The rules can be enabled, disabled, and deleted using `EnableInsightRules`, `DisableInsightRules`, and `DeleteInsightRules`. If a previously created managed rule is currently disabled, a subsequent call to this API will re-enable it. Use `ListManagedInsightRules` to describe all available rules. 

## Request Parameters
<a name="API_PutManagedInsightRules_RequestParameters"></a>

 ** ManagedRules **   
 A list of `ManagedRules` to enable.   
Type: Array of [ManagedRule](API_ManagedRule.md) objects  
Required: Yes

## Response Elements
<a name="API_PutManagedInsightRules_ResponseElements"></a>

The following element is returned by the service.

 ** Failures **   
 An array that lists the rules that could not be enabled.   
Type: Array of [PartialFailure](API_PartialFailure.md) objects

## Errors
<a name="API_PutManagedInsightRules_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_PutManagedInsightRules_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/PutManagedInsightRules) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/PutManagedInsightRules) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/PutManagedInsightRules) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/PutManagedInsightRules) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/PutManagedInsightRules) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/PutManagedInsightRules) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/PutManagedInsightRules) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/PutManagedInsightRules) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/PutManagedInsightRules) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/PutManagedInsightRules) 

# PutMetricAlarm
<a name="API_PutMetricAlarm"></a>

Creates or updates an alarm and associates it with the specified metric, metric math expression, anomaly detection model, Metrics Insights query, or PromQL query. For more information about using a Metrics Insights query for an alarm, see [Create alarms on Metrics Insights queries](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/Create_Metrics_Insights_Alarm.html).

Alarms based on anomaly detection models cannot have Auto Scaling actions.

When this operation creates an alarm, the alarm state is immediately set to `INSUFFICIENT_DATA`. For PromQL alarms, the alarm state is instead immediately set to `OK`. The alarm is then evaluated and its state is set appropriately. Any actions associated with the new state are then executed.

When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.

If you are an IAM user, you must have Amazon EC2 permissions for some alarm operations:
+ The `iam:CreateServiceLinkedRole` permission for all alarms with EC2 actions
+ The `iam:CreateServiceLinkedRole` permissions to create an alarm with Systems Manager OpsItem or response plan actions.

The first time you create an alarm in the Amazon Web Services Management Console, the Amazon CLI, or by using the PutMetricAlarm API, CloudWatch creates the necessary service-linked role for you. The service-linked roles are called `AWSServiceRoleForCloudWatchEvents` and `AWSServiceRoleForCloudWatchAlarms_ActionSSM`. For more information, see [Amazon service-linked role](https://docs.amazonaws.cn/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role).

Each `PutMetricAlarm` action has a maximum uncompressed payload of 120 KB.

 **Cross-account alarms** 

You can set an alarm on metrics in the current account, or in another account. To create a cross-account alarm that watches a metric in a different account, you must have completed the following pre-requisites:
+ The account where the metrics are located (the *sharing account*) must already have a sharing role named **CloudWatch-CrossAccountSharingRole**. If it does not already have this role, you must create it using the instructions in **Set up a sharing account** in [ Cross-account cross-Region CloudWatch console](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html#enable-cross-account-cross-Region). The policy for that role must grant access to the ID of the account where you are creating the alarm. 
+ The account where you are creating the alarm (the *monitoring account*) must already have a service-linked role named **AWSServiceRoleForCloudWatchCrossAccount** to allow CloudWatch to assume the sharing role in the sharing account. If it does not, you must create it following the directions in **Set up a monitoring account** in [ Cross-account cross-Region CloudWatch console](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html#enable-cross-account-cross-Region).

## Request Parameters
<a name="API_PutMetricAlarm_RequestParameters"></a>

 ** ActionsEnabled **   
Indicates whether actions should be executed during any changes to the alarm state. The default is `TRUE`.  
Type: Boolean  
Required: No

 ** AlarmActions **   
The actions to execute when this alarm transitions to the `ALARM` state from any other state. Each action is specified as an Amazon Resource Name (ARN). Valid values:  
 **EC2 actions:**   
+  `arn:aws:automate:region:ec2:stop` 
+  `arn:aws:automate:region:ec2:terminate` 
+  `arn:aws:automate:region:ec2:reboot` 
+  `arn:aws:automate:region:ec2:recover` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Stop/1.0` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Terminate/1.0` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Reboot/1.0` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Recover/1.0` 
 **Autoscaling action:**   
+  `arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name ` 
 **Lambda actions:**   
+ Invoke the latest version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name ` 
+ Invoke a specific version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name:version-number ` 
+ Invoke a function by using an alias Lambda function: `arn:aws:lambda:region:account-id:function:function-name:alias-name ` 
 **SNS notification action:**   
+  `arn:aws:sns:region:account-id:sns-topic-name ` 
 **SSM integration actions:**   
+  `arn:aws:ssm:region:account-id:opsitem:severity#CATEGORY=category-name ` 
+  `arn:aws:ssm-incidents::account-id:responseplan/response-plan-name ` 
 **Start a Amazon Q Developer operational investigation**   
 `arn:aws:aiops:region:account-id:investigation-group:investigation-group-id `   
Type: Array of strings  
Array Members: Maximum number of 5 items.  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: No

 ** AlarmDescription **   
The description for the alarm.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1024.  
Required: No

 ** AlarmName **   
The name for the alarm. This name must be unique within the Region.  
The name must contain only UTF-8 characters, and can't contain ASCII control characters  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

 ** ComparisonOperator **   
 The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.  
The values `LessThanLowerOrGreaterThanUpperThreshold`, `LessThanLowerThreshold`, and `GreaterThanUpperThreshold` are used only for alarms based on anomaly detection models.  
Type: String  
Valid Values: `GreaterThanOrEqualToThreshold | GreaterThanThreshold | LessThanThreshold | LessThanOrEqualToThreshold | LessThanLowerOrGreaterThanUpperThreshold | LessThanLowerThreshold | GreaterThanUpperThreshold`   
Required: No

 ** DatapointsToAlarm **   
The number of data points that must be breaching to trigger the alarm. This is used only if you are setting an "M out of N" alarm. In that case, this value is the M. For more information, see [Evaluating an Alarm](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation) in the *Amazon CloudWatch User Guide*.  
Type: Integer  
Valid Range: Minimum value of 1.  
Required: No

 ** Dimensions **   
The dimensions for the metric specified in `MetricName`.  
Type: Array of [Dimension](API_Dimension.md) objects  
Array Members: Maximum number of 30 items.  
Required: No

 ** EvaluateLowSampleCountPercentile **   
 Used only for alarms based on percentiles. If you specify `ignore`, the alarm state does not change during periods with too few data points to be statistically significant. If you specify `evaluate` or omit this parameter, the alarm is always evaluated and possibly changes state no matter how many data points are available. For more information, see [Percentile-Based CloudWatch Alarms and Low Data Samples](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples).  
Valid Values: `evaluate | ignore`   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** EvaluationCriteria **   
The evaluation criteria for the alarm. For each `PutMetricAlarm` operation, you must specify either `MetricName`, a `Metrics` array, or an `EvaluationCriteria`.  
If you use the `EvaluationCriteria` parameter, you cannot include the `Namespace`, `MetricName`, `Dimensions`, `Period`, `Unit`, `Statistic`, `ExtendedStatistic`, `Metrics`, `Threshold`, `ComparisonOperator`, `ThresholdMetricId`, `EvaluationPeriods`, or `DatapointsToAlarm` parameters of `PutMetricAlarm` in the same operation. Instead, all evaluation parameters are defined within this structure.  
For an example of how to use this parameter, see the **PromQL alarm** example on this page.  
Type: [EvaluationCriteria](API_EvaluationCriteria.md) object  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.  
Required: No

 ** EvaluationInterval **   
The frequency, in seconds, at which the alarm is evaluated. Valid values are 10, 20, 30, and any multiple of 60.  
This parameter is required for alarms that use `EvaluationCriteria`, and cannot be specified for alarms configured with `MetricName` or `Metrics`.  
Type: Integer  
Valid Range: Minimum value of 10. Maximum value of 3600.  
Required: No

 ** EvaluationPeriods **   
The number of periods over which data is compared to the specified threshold. If you are setting an alarm that requires that a number of consecutive data points be breaching to trigger the alarm, this value specifies that number. If you are setting an "M out of N" alarm, this value is the N.  
Type: Integer  
Valid Range: Minimum value of 1.  
Required: No

 ** ExtendedStatistic **   
The extended statistic for the metric specified in `MetricName`. When you call `PutMetricAlarm` and specify a `MetricName`, you must specify either `Statistic` or `ExtendedStatistic` but not both.  
If you specify `ExtendedStatistic`, the following are valid values:  
+  `p90` 
+  `tm90` 
+  `tc90` 
+  `ts90` 
+  `wm90` 
+  `IQM` 
+  `PR(n:m)` where n and m are values of the metric
+  `TC(X%:X%)` where X is between 10 and 90 inclusive.
+  `TM(X%:X%)` where X is between 10 and 90 inclusive.
+  `TS(X%:X%)` where X is between 10 and 90 inclusive.
+  `WM(X%:X%)` where X is between 10 and 90 inclusive.
For more information about these extended statistics, see [CloudWatch statistics definitions](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html).  
Type: String  
Required: No

 ** InsufficientDataActions **   
The actions to execute when this alarm transitions to the `INSUFFICIENT_DATA` state from any other state. Each action is specified as an Amazon Resource Name (ARN). Valid values:  
 **EC2 actions:**   
+  `arn:aws:automate:region:ec2:stop` 
+  `arn:aws:automate:region:ec2:terminate` 
+  `arn:aws:automate:region:ec2:reboot` 
+  `arn:aws:automate:region:ec2:recover` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Stop/1.0` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Terminate/1.0` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Reboot/1.0` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Recover/1.0` 
 **Autoscaling action:**   
+  `arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name ` 
 **Lambda actions:**   
+ Invoke the latest version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name ` 
+ Invoke a specific version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name:version-number ` 
+ Invoke a function by using an alias Lambda function: `arn:aws:lambda:region:account-id:function:function-name:alias-name ` 
 **SNS notification action:**   
+  `arn:aws:sns:region:account-id:sns-topic-name ` 
 **SSM integration actions:**   
+  `arn:aws:ssm:region:account-id:opsitem:severity#CATEGORY=category-name ` 
+  `arn:aws:ssm-incidents::account-id:responseplan/response-plan-name ` 
Type: Array of strings  
Array Members: Maximum number of 5 items.  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: No

 ** MetricName **   
The name for the metric associated with the alarm. For each `PutMetricAlarm` operation, you must specify either `MetricName`, a `Metrics` array, or an `EvaluationCriteria`.  
If you are creating an alarm based on a math expression, you cannot specify this parameter, or any of the `Namespace`, `Dimensions`, `Period`, `Unit`, `Statistic`, or `ExtendedStatistic` parameters. Instead, you specify all this information in the `Metrics` array.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** Metrics **   
An array of `MetricDataQuery` structures that enable you to create an alarm based on the result of a metric math expression. For each `PutMetricAlarm` operation, you must specify either `MetricName`, a `Metrics` array, or an `EvaluationCriteria`.  
Each item in the `Metrics` array either retrieves a metric or performs a math expression.  
One item in the `Metrics` array is the expression that the alarm watches. You designate this expression by setting `ReturnData` to true for this object in the array. For more information, see [MetricDataQuery](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_MetricDataQuery.html).  
If you use the `Metrics` parameter, you cannot include the `Namespace`, `MetricName`, `Dimensions`, `Period`, `Unit`, `Statistic`, or `ExtendedStatistic` parameters of `PutMetricAlarm` in the same operation. Instead, you retrieve the metrics you are using in your math expression as part of the `Metrics` array.  
Type: Array of [MetricDataQuery](API_MetricDataQuery.md) objects  
Required: No

 ** Namespace **   
The namespace for the metric associated specified in `MetricName`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Pattern: `[^:].*`   
Required: No

 ** OKActions **   
The actions to execute when this alarm transitions to an `OK` state from any other state. Each action is specified as an Amazon Resource Name (ARN). Valid values:  
 **EC2 actions:**   
+  `arn:aws:automate:region:ec2:stop` 
+  `arn:aws:automate:region:ec2:terminate` 
+  `arn:aws:automate:region:ec2:reboot` 
+  `arn:aws:automate:region:ec2:recover` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Stop/1.0` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Terminate/1.0` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Reboot/1.0` 
+  `arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Recover/1.0` 
 **Autoscaling action:**   
+  `arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name ` 
 **Lambda actions:**   
+ Invoke the latest version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name ` 
+ Invoke a specific version of a Lambda function: `arn:aws:lambda:region:account-id:function:function-name:version-number ` 
+ Invoke a function by using an alias Lambda function: `arn:aws:lambda:region:account-id:function:function-name:alias-name ` 
 **SNS notification action:**   
+  `arn:aws:sns:region:account-id:sns-topic-name ` 
 **SSM integration actions:**   
+  `arn:aws:ssm:region:account-id:opsitem:severity#CATEGORY=category-name ` 
+  `arn:aws:ssm-incidents::account-id:responseplan/response-plan-name ` 
Type: Array of strings  
Array Members: Maximum number of 5 items.  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: No

 ** Period **   
The length, in seconds, used each time the metric specified in `MetricName` is evaluated. Valid values are 10, 20, 30, and any multiple of 60.  
 `Period` is required for alarms based on static thresholds. If you are creating an alarm based on a metric math expression, you specify the period for each metric within the objects in the `Metrics` array.  
Be sure to specify 10, 20, or 30 only for metrics that are stored by a `PutMetricData` call with a `StorageResolution` of 1. If you specify a period of 10, 20, or 30 for a metric that does not have sub-minute resolution, the alarm still attempts to gather data at the period rate that you specify. In this case, it does not receive data for the attempts that do not correspond to a one-minute data resolution, and the alarm might often lapse into INSUFFICENT\$1DATA status. Specifying 10, 20, or 30 also sets this alarm as a high-resolution alarm, which has a higher charge than other alarms. For more information about pricing, see [Amazon CloudWatch Pricing](https://aws.amazon.com/cloudwatch/pricing/).  
An alarm's total current evaluation period can be no longer than seven days, so `Period` multiplied by `EvaluationPeriods` can't be more than 604,800 seconds. For alarms with a period of less than one hour (3,600 seconds), the total evaluation period can't be longer than one day (86,400 seconds).  
Type: Integer  
Valid Range: Minimum value of 10.  
Required: No

 ** Statistic **   
The statistic for the metric specified in `MetricName`, other than percentile. For percentile statistics, use `ExtendedStatistic`. When you call `PutMetricAlarm` and specify a `MetricName`, you must specify either `Statistic` or `ExtendedStatistic,` but not both.  
Type: String  
Valid Values: `SampleCount | Average | Sum | Minimum | Maximum`   
Required: No

 ** Tags **   
A list of key-value pairs to associate with the alarm. You can associate as many as 50 tags with an alarm. To be able to associate tags with the alarm when you create the alarm, you must have the `cloudwatch:TagResource` permission.  
Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.  
If you are using this operation to update an existing alarm, any tags you specify in this parameter are ignored. To change the tags of an existing alarm, use [TagResource](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_TagResource.html) or [UntagResource](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_UntagResource.html).  
To use this field to set tags for an alarm when you create it, you must be signed on with both the `cloudwatch:PutMetricAlarm` and `cloudwatch:TagResource` permissions.  
Type: Array of [Tag](API_Tag.md) objects  
Required: No

 ** Threshold **   
The value against which the specified statistic is compared.  
This parameter is required for alarms based on static thresholds, but should not be used for alarms based on anomaly detection models.  
Type: Double  
Required: No

 ** ThresholdMetricId **   
If this is an alarm based on an anomaly detection model, make this value match the ID of the `ANOMALY_DETECTION_BAND` function.  
For an example of how to use this parameter, see the **Anomaly Detection Model Alarm** example on this page.  
If your alarm uses this parameter, it cannot have Auto Scaling actions.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** TreatMissingData **   
 Sets how this alarm is to handle missing data points. If `TreatMissingData` is omitted, the default behavior of `missing` is used. For more information, see [Configuring How CloudWatch Alarms Treats Missing Data](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data).  
Valid Values: `breaching | notBreaching | ignore | missing`   
Alarms that evaluate metrics in the `AWS/DynamoDB` namespace always `ignore` missing data even if you choose a different option for `TreatMissingData`. When an `AWS/DynamoDB` metric has missing data, alarms that evaluate that metric remain in their current state.
This parameter is not applicable to PromQL alarms.
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: No

 ** Unit **   
The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the number of bytes that an instance receives on all network interfaces. You can also specify a unit when you create a custom metric. Units help provide conceptual meaning to your data. Metric data points that specify a unit of measure, such as Percent, are aggregated separately. If you are creating an alarm based on a metric math expression, you can specify the unit for each metric (if needed) within the objects in the `Metrics` array.  
If you don't specify `Unit`, CloudWatch retrieves all unit types that have been published for the metric and attempts to evaluate the alarm. Usually, metrics are published with only one unit, so the alarm works as intended.  
However, if the metric is published with multiple types of units and you don't specify a unit, the alarm's behavior is not defined and it behaves unpredictably.  
We recommend omitting `Unit` so that you don't inadvertently specify an incorrect unit that is not published for this metric. Doing so causes the alarm to be stuck in the `INSUFFICIENT DATA` state.  
Type: String  
Valid Values: `Seconds | Microseconds | Milliseconds | Bytes | Kilobytes | Megabytes | Gigabytes | Terabytes | Bits | Kilobits | Megabits | Gigabits | Terabits | Percent | Count | Bytes/Second | Kilobytes/Second | Megabytes/Second | Gigabytes/Second | Terabytes/Second | Bits/Second | Kilobits/Second | Megabits/Second | Gigabits/Second | Terabits/Second | Count/Second | None`   
Required: No

## Errors
<a name="API_PutMetricAlarm_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** LimitExceeded **   
The quota for alarms for this customer has already been reached.    
 ** message **   

HTTP Status Code: 400

## Examples
<a name="API_PutMetricAlarm_Examples"></a>

### Static Threshold Alarm
<a name="API_PutMetricAlarm_Example_1"></a>

The following example creates an alarm that notifies an SNS group when the CPUUtilization of a certain instance goes over 40% for three out of four periods.

#### Sample Request
<a name="API_PutMetricAlarm_Example_1_Request"></a>

```
{
    "Namespace": "AWS/EC2",
    "MetricName": "CPUUtilization",
    "Dimensions": [
        {
            "Name": "InstanceId",
            "Value": "i-1234567890abcdef0"
        }
    ],
    "AlarmActions": [
        "arn:aws:sns:us-west-1:123456789012:my_sns_topic"
    ],
    "ComparisonOperator": "GreaterThanThreshold",
    "DatapointsToAlarm": 3,
    "EvaluationPeriods": 4,
    "Period": 60,
    "Statistic": "Average",
    "Threshold": 40,
    "AlarmDescription": "CPU Utilization of i-1234567890abcdef0 with 40% as threshold",
    "AlarmName": "Instance i-1234567890abcdef0 CPU Utilization"
}
```

### Metric Math Function Alarm
<a name="API_PutMetricAlarm_Example_2"></a>

The following example retrieves three metrics that each track a different type of connection error to a custom service. These error counts are first summed in one expression, then divided by total connection attempts in another expression. The alarm goes to the ALARM state if the error rate is over 40% for three consecutive periods, and notifies two different SNS groups.

#### Sample Request
<a name="API_PutMetricAlarm_Example_2_Request"></a>

```
{
    "AlarmActions": [
        "arn:aws:sns:us-west-1:123456789012:my_sns_topic",
        "arn:aws:sns:us-west-1:123456789012:my_other_sns_topic"
    ],
    "ComparisonOperator": "GreaterThanThreshold",
    "EvaluationPeriods": 3,
    "Threshold": 40,
    "AlarmDescription": "MyService Aggregate Connection Error Rate (Alarm at 40%)",
    "AlarmName": "MyService Connection Error Rate",
    "Metrics": [
        {
            "MetricStat": {
                "Metric": {
                    "MetricName": "ConnectionsFailed",
                    "Namespace": "MyService"
                },
                "Period": 60,
                "Stat": "Sum"
            },
            "Id": "m1",
            "ReturnData": "False"
        },
        {
            "MetricStat": {
                "Metric": {
                    "MetricName": "ConnectionsDropped",
                    "Namespace": "MyService"
                },
                "Period": 60,
                "Stat": "Sum"
            },
            "Id": "m2",
            "ReturnData": "False"
        },
        {
            "MetricStat": {
                "Metric": {
                    "MetricName": "RequestsThrottled",
                    "Namespace": "MyService"
                },
                "Period": 60,
                "Stat": "Sum"
            },
            "Id": "m3",
            "ReturnData": "False"
        },
        {
            "MetricStat": {
                "Metric": {
                    "MetricName": "ConnectionAttempts",
                    "Namespace": "MyService"
                },
                "Period": 60,
                "Stat": "Sum"
            },
            "Id": "m4",
            "ReturnData": "False"
        },
        {
            "Id": "error_total",
            "Expression": "m1+m2+m3",
            "ReturnData": "False"
        },
        {
            "Id": "error_rate",
            "Expression": "(error_total/m4)*100",
            "ReturnData": "true",
            "Label": "Total Connection Error Rate"
        }
    ]
}
```

### Anomaly Detection Model Alarm
<a name="API_PutMetricAlarm_Example_3"></a>

The following example sets an alarm on an anomaly detection model. The Id of `m1` is assigned to the `CPUUtilization` metric of an instance. `t1` is the anomaly detection model function for that metric, and uses 3 standard deviations to set the width of the band. The setting of `ThresholdMetricId` is `t1` and the `ComparisonOperator` is `LessThanLowerOrGreaterThanUpperThreshold`, specifying that the alarm goes to alarm state when the metric value is outside the anomaly model band in either direction for two consecutive evaluation periods.

#### Sample Request
<a name="API_PutMetricAlarm_Example_3_Request"></a>

```
{
    "AlarmActions": [
        "arn:aws:sns:us-west-1:123456789012:my_sns_topic",
        "arn:aws:sns:us-west-1:123456789012:my_other_sns_topic"
    ],
    "AlarmName": "MyAlarmName",
    "AlarmDescription": "This alarm uses an anomaly detection model",
    "Metrics": [
        {
            "Id": "m1",
            "ReturnData": true,
            "MetricStat": {
                "Metric": {
                    "MetricName": "CPUUtilization",
                    "Namespace": "AWS/EC2",
                    "Dimensions": [
                        {
                            "Name": "instanceId",
                            "Value": "i-1234567890abcdef0"
                        }
                    ]
                },
                "Stat": "Average",
                "Period": 60
            }
        },
        {
            "Id": "t1",
            "Expression": "ANOMALY_DETECTION_BAND(m1, 3)"
        }
    ],
    "EvaluationPeriods": 2,
    "ThresholdMetricId": "t1",
    "ComparisonOperator": "LessThanLowerOrGreaterThanUpperThreshold"
}
```

### Metrics Insights query alarm
<a name="API_PutMetricAlarm_Example_4"></a>

The following example sets an alarm on an Metrics Insights query.

#### Sample Request
<a name="API_PutMetricAlarm_Example_4_Request"></a>

```
{
    "AlarmActions": [
        "arn:aws:sns:us-west-1:123456789012:my_sns_topic",
        "arn:aws:sns:us-west-1:123456789012:my_other_sns_topic"
    ],
    "AlarmName": "MetricsInsightsAlarm",
    "AlarmDescription": "This alarm uses a Metrics Insights query",
    "Metrics": [
        {
            "Id": "m1",
            "Expression": "SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/EC2", InstanceId)",
            "Period": 60,
            "Label": "Average CPUUtilization query"
        }
    ],
    "EvaluationPeriods": 1,
    "Threshold": 65,
    "ComparisonOperator": "GreaterThanThreshold"
}
```

### PromQL alarm
<a name="API_PutMetricAlarm_Example_5"></a>

The following example creates an alarm based on a PromQL query. The alarm evaluates the PromQL query every 30 seconds and its contributors (matching series) transition to the ALARM state if they are continuously breaching for 300 seconds (pending period). Contributors transition back to OK after they are no longer breaching for 120 seconds (recovery period).

#### Sample Request
<a name="API_PutMetricAlarm_Example_5_Request"></a>

```
{
    "AlarmName": "HighCPUPromQLAlarm",
    "AlarmDescription": "Alarm when average CPU exceeds 80% using PromQL",
    "AlarmActions": [
        "arn:aws:sns:us-west-1:123456789012:my_sns_topic"
    ],
    "EvaluationCriteria": {
        "PromQLCriteria": {
            "Query": "avg(cpu_utilization_percent) > 80",
            "PendingPeriod": 300,
            "RecoveryPeriod": 120
        }
    },
    "EvaluationInterval": 30
}
```

## See Also
<a name="API_PutMetricAlarm_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/PutMetricAlarm) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/PutMetricAlarm) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/PutMetricAlarm) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/PutMetricAlarm) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/PutMetricAlarm) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/PutMetricAlarm) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/PutMetricAlarm) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/PutMetricAlarm) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/PutMetricAlarm) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/PutMetricAlarm) 

# PutMetricData
<a name="API_PutMetricData"></a>

Publishes metric data to Amazon CloudWatch. CloudWatch associates the data with the specified metric. If the specified metric does not exist, CloudWatch creates the metric. When CloudWatch creates a metric, it can take up to fifteen minutes for the metric to appear in calls to [ListMetrics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html).

You can publish metrics with associated entity data (so that related telemetry can be found and viewed together), or publish metric data by itself. To send entity data with your metrics, use the `EntityMetricData` parameter. To send metrics without entity data, use the `MetricData` parameter. The `EntityMetricData` structure includes `MetricData` structures for the metric data.

You can publish either individual values in the `Value` field, or arrays of values and the number of times each value occurred during the period by using the `Values` and `Counts` fields in the `MetricData` structure. Using the `Values` and `Counts` method enables you to publish up to 150 values per metric with one `PutMetricData` request, and supports retrieving percentile statistics on this data.

Each `PutMetricData` request is limited to 1 MB in size for HTTP POST requests. You can send a payload compressed by gzip. Each request is also limited to no more than 1000 different metrics (across both the `MetricData` and `EntityMetricData` properties).

Although the `Value` parameter accepts numbers of type `Double`, CloudWatch rejects values that are either too small or too large. Values must be in the range of -2^360 to 2^360. In addition, special values (for example, NaN, \$1Infinity, -Infinity) are not supported.

You can use up to 30 dimensions per metric to further clarify what data the metric collects. Each dimension consists of a Name and Value pair. For more information about specifying dimensions, see [Publishing Metrics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/publishingMetrics.html) in the *Amazon CloudWatch User Guide*.

You specify the time stamp to be associated with each data point. You can specify time stamps that are as much as two weeks before the current date, and as much as 2 hours after the current day and time.

Data points with time stamps from 24 hours ago or longer can take at least 48 hours to become available for [GetMetricData](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) or [GetMetricStatistics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html) from the time they are submitted. Data points with time stamps between 3 and 24 hours ago can take as much as 2 hours to become available for [GetMetricData](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) or [GetMetricStatistics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html).

CloudWatch needs raw data points to calculate percentile statistics. If you publish data using a statistic set instead, you can only retrieve percentile statistics for this data if one of the following conditions is true:
+ The `SampleCount` value of the statistic set is 1 and `Min`, `Max`, and `Sum` are all equal.
+ The `Min` and `Max` are equal, and `Sum` is equal to `Min` multiplied by `SampleCount`.

## Request Parameters
<a name="API_PutMetricData_RequestParameters"></a>

 ** EntityMetricData **   
Data for metrics that contain associated entity information. You can include up to two `EntityMetricData` objects, each of which can contain a single `Entity` and associated metrics.  
The limit of metrics allowed, 1000, is the sum of both `EntityMetricData` and `MetricData` metrics.  
Type: Array of [EntityMetricData](API_EntityMetricData.md) objects  
Required: No

 ** MetricData **   
The data for the metrics. Use this parameter if your metrics do not contain associated entities. The array can include no more than 1000 metrics per call.  
The limit of metrics allowed, 1000, is the sum of both `EntityMetricData` and `MetricData` metrics.  
Type: Array of [MetricDatum](API_MetricDatum.md) objects  
Required: No

 ** Namespace **   
The namespace for the metric data. You can use ASCII characters for the namespace, except for control characters which are not supported.  
To avoid conflicts with Amazon service namespaces, you should not specify a namespace that begins with `AWS/`   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Pattern: `[^:].*`   
Required: Yes

 ** StrictEntityValidation **   
Whether to accept valid metric data when an invalid entity is sent.  
+ When set to `true`: Any validation error (for entity or metric data) will fail the entire request, and no data will be ingested. The failed operation will return a 400 result with the error.
+ When set to `false`: Validation errors in the entity will not associate the metric with the entity, but the metric data will still be accepted and ingested. Validation errors in the metric data will fail the entire request, and no data will be ingested.

  In the case of an invalid entity, the operation will return a `200` status, but an additional response header will contain information about the validation errors. The new header, `X-Amzn-Failure-Message` is an enumeration of the following values:
  +  `InvalidEntity` - The provided entity is invalid.
  +  `InvalidKeyAttributes` - The provided `KeyAttributes` of an entity is invalid.
  +  `InvalidAttributes` - The provided `Attributes` of an entity is invalid.
  +  `InvalidTypeValue` - The provided `Type` in the `KeyAttributes` of an entity is invalid.
  +  `EntitySizeTooLarge` - The number of `EntityMetricData` objects allowed is 2.
  +  `MissingRequiredFields` - There are missing required fields in the `KeyAttributes` for the provided `Type`.

  For details of the requirements for specifying an entity, see [How to add related information to telemetry](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/adding-your-own-related-telemetry.html) in the *CloudWatch User Guide*.
This parameter is *required* when `EntityMetricData` is included.  
Type: Boolean  
Required: No

## Errors
<a name="API_PutMetricData_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterCombination **   
Parameters were used together that cannot be used together.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## Examples
<a name="API_PutMetricData_Examples"></a>

### Example
<a name="API_PutMetricData_Example_1"></a>

The following example puts data for a single metric containing one dimension:

#### Sample Request
<a name="API_PutMetricData_Example_1_Request"></a>

```
https://monitoring.us-west-1.amazonaws.com
?Action=PutMetricData
&Version=2010-08-01
&Namespace=TestNamespace
&MetricData.member.1.MetricName=buffers
&MetricData.member.1.Unit=Bytes
&MetricData.member.1.Value=231434333
&MetricData.member.1.Dimensions.member.1.Name=InstanceType
&MetricData.member.1.Dimensions.member.1.Value=m1.small
&AUTHPARAMS
```

### Example
<a name="API_PutMetricData_Example_2"></a>

The following example puts data for a single metric containing two dimensions:

#### Sample Request
<a name="API_PutMetricData_Example_2_Request"></a>

```
https://monitoring.us-west-1.amazonaws.com
?Action=PutMetricData
&Version=2010-08-01
&Namespace=TestNamespace
&MetricData.member.1.MetricName=buffers
&MetricData.member.1.Unit=Bytes
&MetricData.member.1.Value=231434333
&MetricData.member.1.Dimensions.member.1.Name=InstanceID
&MetricData.member.1.Dimensions.member.1.Value=i-aaba32d4
&MetricData.member.1.Dimensions.member.2.Name=InstanceType
&MetricData.member.1.Dimensions.member.2.Value=m1.small
&AUTHPARAMS
```

### Example
<a name="API_PutMetricData_Example_3"></a>

The following example puts data for two metrics, each with two dimensions:

#### Sample Request
<a name="API_PutMetricData_Example_3_Request"></a>

```
https://monitoring.us-west-1.amazonaws.com
?Action=PutMetricData
&Version=2010-08-01
&Namespace=TestNamespace
&MetricData.member.1.MetricName=buffers
&MetricData.member.1.Unit=Bytes
&MetricData.member.1.Value=231434333
&MetricData.member.1.Dimensions.member.1.Name=InstanceID
&MetricData.member.1.Dimensions.member.1.Value=i-aaba32d4
&MetricData.member.1.Dimensions.member.2.Name=InstanceType
&MetricData.member.1.Dimensions.member.2.Value=m1.small
&MetricData.member.2.MetricName=latency
&MetricData.member.2.Unit=Milliseconds
&MetricData.member.2.Value=23
&MetricData.member.2.Dimensions.member.1.Name=InstanceID
&MetricData.member.2.Dimensions.member.1.Value=i-aaba32d4
&MetricData.member.2.Dimensions.member.2.Name=InstanceType
&MetricData.member.2.Dimensions.member.2.Value=m1.small
&AUTHPARAMS
```

### Example
<a name="API_PutMetricData_Example_4"></a>

The following example puts data for a high-resolution metric:

#### Sample Request
<a name="API_PutMetricData_Example_4_Request"></a>

```
https://monitoring.us-west-1.amazonaws.com
?Action=PutMetricData
&Version=2010-08-01
&Namespace=HighResolutionMetric
&MetricData.member.1.MetricName=HighResdata
&MetricData.member.1.Unit=Bytes
&MetricData.member.1.Value=542868
&MetricData.member.1.StorageResolution=1
&AUTHPARAMS
```

### Example
<a name="API_PutMetricData_Example_5"></a>

The following example puts multiple values for each of two metrics, using `Values` and `Counts` arrays:

#### Sample Request
<a name="API_PutMetricData_Example_5_Request"></a>

```
https://monitoring.us-west-1.amazonaws.com
?Action=PutMetricData
&Version=2010-08-01
&Namespace=TestNamespace
&MetricData.member.1.MetricName=Reads
&MetricData.member.1.Unit=Count
&MetricData.member.1.Values.member.1=5
&MetricData.member.1.Values.member.2=8
&MetricData.member.1.Values.member.3=10
&MetricData.member.1.Values.member.4=9
&MetricData.member.1.Counts.member.1=1
&MetricData.member.1.Counts.member.2=5
&MetricData.member.1.Counts.member.3=6
&MetricData.member.1.Counts.member.4=5
&MetricData.member.1.Dimensions.member.1.Name=InstanceID
&MetricData.member.1.Dimensions.member.1.Value=i-aaba32d4
&MetricData.member.2.MetricName=Writes
&MetricData.member.2.Unit=Count
&MetricData.member.2.Values.member.1=2
&MetricData.member.2.Values.member.2=3
&MetricData.member.2.Values.member.3=0
&MetricData.member.2.Counts.member.1=2
&MetricData.member.2.Counts.member.2=2
&MetricData.member.2.Counts.member.3=1
&MetricData.member.2.Dimensions.member.1.Name=InstanceID
&MetricData.member.2.Dimensions.member.1.Value=i-aaba32d4
&AUTHPARAMS
```

### Example
<a name="API_PutMetricData_Example_6"></a>

The following example uses `EntityMetricData` to put a metric with entity data for a service running in Amazon EC2:

#### Sample Request
<a name="API_PutMetricData_Example_6_Request"></a>

```
https://monitoring.us-west-1.amazonaws.com
?Action=PutMetricData
&Version=2010-08-01
&StrictEntityValidation=true
&Namespace=TestNamespace
&EntityMetricData.member.1.Entity.KeyAttributes.entry.1.key=Type
&EntityMetricData.member.1.Entity.KeyAttributes.entry.1.value=Service
&EntityMetricData.member.1.Entity.KeyAttributes.entry.2.key=Name
&EntityMetricData.member.1.Entity.KeyAttributes.entry.2.value=MyTestService
&EntityMetricData.member.1.Entity.KeyAttributes.entry.3.key=Environment
&EntityMetricData.member.1.Entity.KeyAttributes.entry.3.value=MyTestEnvironment
&EntityMetricData.member.1.Entity.Attributes.entry.1.key=PlatformType
&EntityMetricData.member.1.Entity.Attributes.entry.1.value=AWS::EC2
&EntityMetricData.member.1.Entity.Attributes.entry.2.key=EC2.InstanceId
&EntityMetricData.member.1.Entity.Attributes.entry.2.value=i-1234567890abcdef0
&EntityMetricData.member.1.MetricData.member.1.MetricName=buffers
&EntityMetricData.member.1.MetricData.member.1.Timestamp=2024-11-06T02:16:28Z
&EntityMetricData.member.1.MetricData.member.1.Unit=Count
&EntityMetricData.member.1.MetricData.member.1.Values.member.1=2
&EntityMetricData.member.1.MetricData.member.1.Values.member.2=3
&EntityMetricData.member.1.MetricData.member.1.Values.member.3=0
&EntityMetricData.member.1.MetricData.member.1.Counts.member.1=2
&EntityMetricData.member.1.MetricData.member.1.Counts.member.2=2
&EntityMetricData.member.1.MetricData.member.1.Counts.member.3=1
&EntityMetricData.member.1.MetricData.member.1.Dimensions.member.1.Name=InstanceID
&EntityMetricData.member.1.MetricData.member.1.Dimensions.member.1.Value=i-aaba32d4
&EntityMetricData.member.1.MetricData.member.1.Dimensions.member.2.Name=InstanceType
&EntityMetricData.member.1.MetricData.member.1.Dimensions.member.2.Value=m1.small
&AUTHPARAMS
```

### Example
<a name="API_PutMetricData_Example_7"></a>

The following example uses `EntityMetricData` to put a metric with entity data for a service running in Lambda:

#### Sample Request
<a name="API_PutMetricData_Example_7_Request"></a>

```
https://monitoring.us-west-1.amazonaws.com
?Action=PutMetricData
&Version=2010-08-01
&StrictEntityValidation=true
&Namespace=TestNamespace
&EntityMetricData.member.1.Entity.KeyAttributes.entry.1.key=Type
&EntityMetricData.member.1.Entity.KeyAttributes.entry.1.value=Service
&EntityMetricData.member.1.Entity.KeyAttributes.entry.2.key=Name
&EntityMetricData.member.1.Entity.KeyAttributes.entry.2.value=MyTestService
&EntityMetricData.member.1.Entity.KeyAttributes.entry.3.key=Environment
&EntityMetricData.member.1.Entity.KeyAttributes.entry.3.value=MyTestEnvironment
&EntityMetricData.member.1.Entity.Attributes.entry.1.key=PlatformType
&EntityMetricData.member.1.Entity.Attributes.entry.1.value=AWS::Lambda
&EntityMetricData.member.1.Entity.Attributes.entry.2.key=Lambda.Function
&EntityMetricData.member.1.Entity.Attributes.entry.2.value=MyTestFunction
&EntityMetricData.member.1.MetricData.member.1.MetricName=faults
&EntityMetricData.member.1.MetricData.member.1.Timestamp=2024-11-06T02:16:28Z
&EntityMetricData.member.1.MetricData.member.1.Unit=Count
&EntityMetricData.member.1.MetricData.member.1.Values.member.1=2
&EntityMetricData.member.1.MetricData.member.1.Values.member.2=3
&EntityMetricData.member.1.MetricData.member.1.Values.member.3=0
&EntityMetricData.member.1.MetricData.member.1.Counts.member.1=2
&EntityMetricData.member.1.MetricData.member.1.Counts.member.2=2
&EntityMetricData.member.1.MetricData.member.1.Counts.member.3=1
&EntityMetricData.member.1.MetricData.member.1.Dimensions.member.1.Name=InstanceID
&EntityMetricData.member.1.MetricData.member.1.Dimensions.member.1.Value=i-aaba32d4
&EntityMetricData.member.1.MetricData.member.1.Dimensions.member.2.Name=InstanceType
&EntityMetricData.member.1.MetricData.member.1.Dimensions.member.2.Value=m1.small
&AUTHPARAMS
```

## See Also
<a name="API_PutMetricData_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/PutMetricData) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/PutMetricData) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/PutMetricData) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/PutMetricData) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/PutMetricData) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/PutMetricData) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/PutMetricData) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/PutMetricData) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/PutMetricData) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/PutMetricData) 

# PutMetricStream
<a name="API_PutMetricStream"></a>

Creates or updates a metric stream. Metric streams can automatically stream CloudWatch metrics to Amazon destinations, including Amazon S3, and to many third-party solutions.

For more information, see [ Using Metric Streams](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch-Metric-Streams.html).

To create a metric stream, you must be signed in to an account that has the `iam:PassRole` permission and either the `CloudWatchFullAccess` policy or the `cloudwatch:PutMetricStream` permission.

When you create or update a metric stream, you choose one of the following:
+ Stream metrics from all metric namespaces in the account.
+ Stream metrics from all metric namespaces in the account, except for the namespaces that you list in `ExcludeFilters`.
+ Stream metrics from only the metric namespaces that you list in `IncludeFilters`.

By default, a metric stream always sends the `MAX`, `MIN`, `SUM`, and `SAMPLECOUNT` statistics for each metric that is streamed. You can use the `StatisticsConfigurations` parameter to have the metric stream send additional statistics in the stream. Streaming additional statistics incurs additional costs. For more information, see [Amazon CloudWatch Pricing](https://aws.amazon.com/cloudwatch/pricing/). 

When you use `PutMetricStream` to create a new metric stream, the stream is created in the `running` state. If you use it to update an existing stream, the state of the stream is not changed.

If you are using CloudWatch cross-account observability and you create a metric stream in a monitoring account, you can choose whether to include metrics from source accounts in the stream. For more information, see [CloudWatch cross-account observability](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html).

## Request Parameters
<a name="API_PutMetricStream_RequestParameters"></a>

 ** ExcludeFilters **   
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.  
You cannot include `ExcludeFilters` and `IncludeFilters` in the same operation.  
Type: Array of [MetricStreamFilter](API_MetricStreamFilter.md) objects  
Required: No

 ** FirehoseArn **   
The ARN of the Amazon Kinesis Data Firehose delivery stream to use for this metric stream. This Amazon Kinesis Data Firehose delivery stream must already exist and must be in the same account as the metric stream.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: Yes

 ** IncludeFilters **   
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.  
You cannot include `IncludeFilters` and `ExcludeFilters` in the same operation.  
Type: Array of [MetricStreamFilter](API_MetricStreamFilter.md) objects  
Required: No

 ** IncludeLinkedAccountsMetrics **   
If you are creating a metric stream in a monitoring account, specify `true` to include metrics from source accounts in the metric stream.  
Type: Boolean  
Required: No

 ** Name **   
If you are creating a new metric stream, this is the name for the new stream. The name must be different than the names of other metric streams in this account and Region.  
If you are updating a metric stream, specify the name of that stream here.  
Valid characters are A-Z, a-z, 0-9, "-" and "\$1".  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

 ** OutputFormat **   
The output format for the stream. Valid values are `json`, `opentelemetry1.0`, and `opentelemetry0.7`. For more information about metric stream output formats, see [ Metric streams output formats](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-formats.html).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Valid Values: `json | opentelemetry0.7 | opentelemetry1.0`   
Required: Yes

 ** RoleArn **   
The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Data Firehose resources. This IAM role must already exist and must be in the same account as the metric stream. This IAM role must include the following permissions:  
+ firehose:PutRecord
+ firehose:PutRecordBatch
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: Yes

 ** StatisticsConfigurations **   
By default, a metric stream always sends the `MAX`, `MIN`, `SUM`, and `SAMPLECOUNT` statistics for each metric that is streamed. You can use this parameter to have the metric stream also send additional statistics in the stream. This array can have up to 100 members.  
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's `OutputFormat`. If the `OutputFormat` is `json`, you can stream any additional statistic that is supported by CloudWatch, listed in [ CloudWatch statistics definitions](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html.html). If the `OutputFormat` is `opentelemetry1.0` or `opentelemetry0.7`, you can stream percentile statistics such as p95, p99.9, and so on.  
Type: Array of [MetricStreamStatisticsConfiguration](API_MetricStreamStatisticsConfiguration.md) objects  
Required: No

 ** Tags **   
A list of key-value pairs to associate with the metric stream. You can associate as many as 50 tags with a metric stream.  
Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.  
You can use this parameter only when you are creating a new metric stream. If you are using this operation to update an existing metric stream, any tags you specify in this parameter are ignored. To change the tags of an existing metric stream, use [TagResource](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_TagResource.html) or [UntagResource](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_UntagResource.html).  
Type: Array of [Tag](API_Tag.md) objects  
Required: No

## Response Elements
<a name="API_PutMetricStream_ResponseElements"></a>

The following element is returned by the service.

 ** Arn **   
The ARN of the metric stream.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.

## Errors
<a name="API_PutMetricStream_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ConcurrentModificationException **   
More than one process tried to modify a resource at the same time.  
HTTP Status Code: 429

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterCombination **   
Parameters were used together that cannot be used together.    
 ** message **   

HTTP Status Code: 400

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## Examples
<a name="API_PutMetricStream_Examples"></a>

### Stream two namespaces with the default statistics
<a name="API_PutMetricStream_Example_1"></a>

The following example creates a metric stream that streams all the metrics from the `AWS/EC2` and `AWS/ELB` namespaces, with only the default statistics.

#### Sample Request
<a name="API_PutMetricStream_Example_1_Request"></a>

```
{
  "Name": "MyMetricStream",
  "FirehoseArn": "arn:aws:firehose:us-east-1:123456789098:stream/MyFirehose",
  "RoleArn": "arn:aws:iam::123456789098:role/MyFirehoseWriteAccessRole",
  "IncludeFilters": [
    {
      "Namespace": "AWS/EC2"
    },
    {
      "Namespace": "AWS/ELB"
    }
  ],
  "OutputFormat": "opentelemetry1.0"
}
```

### In a monitoring account, stream two namespaces with default statistics from all source accounts
<a name="API_PutMetricStream_Example_2"></a>

The following example creates a metric stream that streams all the metrics from the `AWS/EC2` and `AWS/ELB` namespaces from this monitoring account and from all source accounts that it is linked to.

#### Sample Request
<a name="API_PutMetricStream_Example_2_Request"></a>

```
{
  "Name": "MyMetricStream",
  "FirehoseArn": "arn:aws:firehose:us-east-1:123456789098:stream/MyFirehose",
  "RoleArn": "arn:aws:iam::123456789098:role/MyFirehoseWriteAccessRole",
  "IncludeLinkedAccountsMetrics": "true",
  "IncludeFilters": [
    {
      "Namespace": "AWS/EC2"
    },
    {
      "Namespace": "AWS/ELB"
    }
  ],
  "OutputFormat": "opentelemetry1.0"
}
```

### Stream additional statistics
<a name="API_PutMetricStream_Example_3"></a>

The following example creates a metric stream that streams all metrics from the `AWS/EC2` namespace with only the default statistics, and also streams two other metrics with the default statistics and some additional statistics.

#### Sample Request
<a name="API_PutMetricStream_Example_3_Request"></a>

```
{
    "Name": "MyMetricStream",
    "FirehoseArn": "arn:aws:firehose:us-east-1:123456789098:stream/MyFirehose",
    "RoleArn": "arn:aws:iam::123456789098:role/MyFirehoseWriteAccessRole",
    "IncludeFilters": [
        {
            "Namespace": "AWS/EC2"
        }
    ],
    "OutputFormat": "json",
    "StatisticsConfigurations": [
        {
            "IncludeMetrics": [
                {
                    "Namespace": "AWS/ApplicationELB",
                    "MetricName": "TargetResponseTime"
                },
                {
                    "Namespace": "AWS/ELB",
                    "MetricName": "Latency"
                }
            ],
            "AdditionalStatistics": [
                "tm90",
                "p90",
                "p99",
                "p99.9"
            ]
        }
    ]
}
```

## See Also
<a name="API_PutMetricStream_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/PutMetricStream) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/PutMetricStream) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/PutMetricStream) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/PutMetricStream) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/PutMetricStream) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/PutMetricStream) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/PutMetricStream) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/PutMetricStream) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/PutMetricStream) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/PutMetricStream) 

# SetAlarmState
<a name="API_SetAlarmState"></a>

Temporarily sets the state of an alarm for testing purposes. When the updated state differs from the previous value, the action configured for the appropriate state is invoked. For example, if your alarm is configured to send an Amazon SNS message when an alarm is triggered, temporarily changing the alarm state to `ALARM` sends an SNS message.

Metric alarms returns to their actual state quickly, often within seconds. Because the metric alarm state change happens quickly, it is typically only visible in the alarm's **History** tab in the Amazon CloudWatch console or through [DescribeAlarmHistory](https://docs.amazonaws.cn/AmazonCloudWatch/latest/APIReference/API_DescribeAlarmHistory.html).

If you use `SetAlarmState` on a composite alarm, the composite alarm is not guaranteed to return to its actual state. It returns to its actual state only once any of its children alarms change state. It is also reevaluated if you update its configuration.

If an alarm triggers EC2 Auto Scaling policies or application Auto Scaling policies, you must include information in the `StateReasonData` parameter to enable the policy to take the correct action.

## Request Parameters
<a name="API_SetAlarmState_RequestParameters"></a>

 ** AlarmName **   
The name of the alarm.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

 ** StateReason **   
The reason that this alarm is set to this specific state, in text format.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1023.  
Required: Yes

 ** StateReasonData **   
The reason that this alarm is set to this specific state, in JSON format.  
For SNS or EC2 alarm actions, this is just informational. But for EC2 Auto Scaling or application Auto Scaling alarm actions, the Auto Scaling policy uses the information in this field to take the correct action.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 4000.  
Required: No

 ** StateValue **   
The value of the state.  
Type: String  
Valid Values: `OK | ALARM | INSUFFICIENT_DATA`   
Required: Yes

## Errors
<a name="API_SetAlarmState_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidFormat **   
Data was not syntactically valid JSON.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFound **   
The named resource does not exist.    
 ** message **   

HTTP Status Code: 404

## Examples
<a name="API_SetAlarmState_Examples"></a>

### Example
<a name="API_SetAlarmState_Example_1"></a>

The following example sets the alarm state to ALARM, and provides information inside of `StateReasonData` so that Auto Scaling actions can be performed correctly according to your Auto Scaling policies. 

```
{
    "AlarmName": "ExampleAlarmName",
    "StateValue": "ALARM",
    "StateReason": "Testing Alarm State",
    "StateReasonData": {
        "Version": "1.0",
        "QueryDate": "2018-10-31T14:32:52.031+0000",
        "StartDate": "2018-10-31T14:31:00.000+0000",
        "Statistic": "Average",
        "Period": 60,
        "RecentDatapoints": [
            100
        ],
        "Threshold": 50
    }
}
```

## See Also
<a name="API_SetAlarmState_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/SetAlarmState) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/SetAlarmState) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/SetAlarmState) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/SetAlarmState) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/SetAlarmState) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/SetAlarmState) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/SetAlarmState) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/SetAlarmState) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/SetAlarmState) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/SetAlarmState) 

# StartMetricStreams
<a name="API_StartMetricStreams"></a>

Starts the streaming of metrics for one or more of your metric streams.

## Request Parameters
<a name="API_StartMetricStreams_RequestParameters"></a>

 ** Names **   
The array of the names of metric streams to start streaming.  
This is an "all or nothing" operation. If you do not have permission to access all of the metric streams that you list here, then none of the streams that you list in the operation will start streaming.  
Type: Array of strings  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

## Errors
<a name="API_StartMetricStreams_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_StartMetricStreams_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/StartMetricStreams) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/StartMetricStreams) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/StartMetricStreams) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/StartMetricStreams) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/StartMetricStreams) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/StartMetricStreams) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/StartMetricStreams) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/StartMetricStreams) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/StartMetricStreams) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/StartMetricStreams) 

# StartOTelEnrichment
<a name="API_StartOTelEnrichment"></a>

Enables enrichment and PromQL access for CloudWatch vended metrics for [supported Amazon resources](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/UsingResourceTagsForTelemetry.html) in the account. Once enabled, metrics that contain a resource identifier dimension (for example, EC2 `CPUUtilization` with an `InstanceId` dimension) are enriched with resource ARN and resource tag labels and become queryable using PromQL.

Before calling this operation, you must enable resource tags on telemetry for your account. For more information, see [Enable resource tags on telemetry](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/EnableResourceTagsOnTelemetry.html).

## Errors
<a name="API_StartOTelEnrichment_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

## See Also
<a name="API_StartOTelEnrichment_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/StartOTelEnrichment) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/StartOTelEnrichment) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/StartOTelEnrichment) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/StartOTelEnrichment) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/StartOTelEnrichment) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/StartOTelEnrichment) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/StartOTelEnrichment) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/StartOTelEnrichment) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/StartOTelEnrichment) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/StartOTelEnrichment) 

# StopMetricStreams
<a name="API_StopMetricStreams"></a>

Stops the streaming of metrics for one or more of your metric streams.

## Request Parameters
<a name="API_StopMetricStreams_RequestParameters"></a>

 ** Names **   
The array of the names of metric streams to stop streaming.  
This is an "all or nothing" operation. If you do not have permission to access all of the metric streams that you list here, then none of the streams that you list in the operation will stop streaming.  
Type: Array of strings  
Length Constraints: Minimum length of 1. Maximum length of 255.  
Required: Yes

## Errors
<a name="API_StopMetricStreams_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** MissingParameter **   
An input parameter that is required is missing.    
 ** message **   

HTTP Status Code: 400

## See Also
<a name="API_StopMetricStreams_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/StopMetricStreams) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/StopMetricStreams) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/StopMetricStreams) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/StopMetricStreams) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/StopMetricStreams) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/StopMetricStreams) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/StopMetricStreams) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/StopMetricStreams) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/StopMetricStreams) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/StopMetricStreams) 

# StopOTelEnrichment
<a name="API_StopOTelEnrichment"></a>

Disables enrichment and PromQL access for CloudWatch vended metrics for [supported Amazon resources](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/UsingResourceTagsForTelemetry.html) in the account. After disabling, these metrics are no longer enriched with resource ARN and resource tag labels, and cannot be queried using PromQL.

## Errors
<a name="API_StopOTelEnrichment_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

## See Also
<a name="API_StopOTelEnrichment_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/StopOTelEnrichment) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/StopOTelEnrichment) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/StopOTelEnrichment) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/StopOTelEnrichment) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/StopOTelEnrichment) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/StopOTelEnrichment) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/StopOTelEnrichment) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/StopOTelEnrichment) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/StopOTelEnrichment) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/StopOTelEnrichment) 

# TagResource
<a name="API_TagResource"></a>

Assigns one or more tags (key-value pairs) to the specified CloudWatch resource. Currently, the only CloudWatch resources that can be tagged are alarms and Contributor Insights rules.

Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.

Tags don't have any semantic meaning to Amazon and are interpreted strictly as strings of characters.

You can use the `TagResource` action with an alarm that already has tags. If you specify a new tag key for the alarm, this tag is appended to the list of tags associated with the alarm. If you specify a tag key that is already associated with the alarm, the new tag value that you specify replaces the previous value for that tag.

You can associate as many as 50 tags with a CloudWatch resource.

## Request Parameters
<a name="API_TagResource_RequestParameters"></a>

 ** ResourceARN **   
The ARN of the CloudWatch resource that you're adding tags to.  
The ARN format of an alarm is `arn:aws:cloudwatch:Region:account-id:alarm:alarm-name `   
The ARN format of a Contributor Insights rule is `arn:aws:cloudwatch:Region:account-id:insight-rule/insight-rule-name `   
For more information about ARN format, see [ Resource Types Defined by Amazon CloudWatch](https://docs.amazonaws.cn/IAM/latest/UserGuide/list_amazoncloudwatch.html#amazoncloudwatch-resources-for-iam-policies) in the *Amazon Web Services General Reference*.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: Yes

 ** Tags **   
The list of key-value pairs to associate with the alarm.  
Type: Array of [Tag](API_Tag.md) objects  
Required: Yes

## Errors
<a name="API_TagResource_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ConcurrentModificationException **   
More than one process tried to modify a resource at the same time.  
HTTP Status Code: 429

 ** ConflictException **   
This operation attempted to create a resource that already exists.  
HTTP Status Code: 409

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFoundException **   
The named resource does not exist.  
HTTP Status Code: 404

## See Also
<a name="API_TagResource_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/TagResource) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/TagResource) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/TagResource) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/TagResource) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/TagResource) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/TagResource) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/TagResource) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/TagResource) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/TagResource) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/TagResource) 

# UntagResource
<a name="API_UntagResource"></a>

Removes one or more tags from the specified resource.

## Request Parameters
<a name="API_UntagResource_RequestParameters"></a>

 ** ResourceARN **   
The ARN of the CloudWatch resource that you're removing tags from.  
The ARN format of an alarm is `arn:aws:cloudwatch:Region:account-id:alarm:alarm-name `   
The ARN format of a Contributor Insights rule is `arn:aws:cloudwatch:Region:account-id:insight-rule/insight-rule-name `   
For more information about ARN format, see [ Resource Types Defined by Amazon CloudWatch](https://docs.amazonaws.cn/IAM/latest/UserGuide/list_amazoncloudwatch.html#amazoncloudwatch-resources-for-iam-policies) in the *Amazon Web Services General Reference*.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1024.  
Required: Yes

 ** TagKeys **   
The list of tag keys to remove from the resource.  
Type: Array of strings  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Required: Yes

## Errors
<a name="API_UntagResource_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ConcurrentModificationException **   
More than one process tried to modify a resource at the same time.  
HTTP Status Code: 429

 ** ConflictException **   
This operation attempted to create a resource that already exists.  
HTTP Status Code: 409

 ** InternalServiceError **   
Request processing has failed due to some unknown error, exception, or failure.    
 ** Message **   

HTTP Status Code: 500

 ** InvalidParameterValue **   
The value of an input parameter is bad or out-of-range.    
 ** message **   

HTTP Status Code: 400

 ** ResourceNotFoundException **   
The named resource does not exist.  
HTTP Status Code: 404

## See Also
<a name="API_UntagResource_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/monitoring-2010-08-01/UntagResource) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/monitoring-2010-08-01/UntagResource) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/monitoring-2010-08-01/UntagResource) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/monitoring-2010-08-01/UntagResource) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/monitoring-2010-08-01/UntagResource) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/monitoring-2010-08-01/UntagResource) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/monitoring-2010-08-01/UntagResource) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/monitoring-2010-08-01/UntagResource) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/monitoring-2010-08-01/UntagResource) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/monitoring-2010-08-01/UntagResource) 