AWS SDK Version 2 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

.NET Framework 4.5
 
Temporarily sets the state of an alarm. When the updated StateValue 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's state to ALARM will send an Amazon SNS message. This is not a permanent change. The next periodic alarm check (in about a minute) will set the alarm to its actual state. Because the alarm state change happens very quickly, it is typically only visibile in the alarm's History tab in the Amazon CloudWatch console or through DescribeAlarmHistory.

Namespace: Amazon.CloudWatch
Assembly: AWSSDK.dll
Version: (assembly version)

Syntax

C#
public virtual SetAlarmStateResponse SetAlarmState(
         SetAlarmStateRequest request
)

Parameters

request
Type: Amazon.CloudWatch.Model.SetAlarmStateRequest

Container for the necessary parameters to execute the SetAlarmState service method.

Return Value
Type: Amazon.CloudWatch.Model.SetAlarmStateResponse
The response from the SetAlarmState service method, as returned by CloudWatch.

Exceptions

ExceptionCondition
InvalidFormatException Data was not syntactically valid JSON.
ResourceNotFoundException The named resource does not exist.

Examples

This example shows how to temporarily set an alarm's state.

Set alarm state example

var client = new AmazonCloudWatchClient();

var request = new SetAlarmStateRequest
{
  AlarmName = "Offline Instances",
  StateReason = "Too many instances are offline.",
  StateValue = StateValue.ALARM
};

client.SetAlarmState(request);
      

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5