Skip to content

Instantly share code, notes, and snippets.

@knil-sama
Last active May 14, 2018 14:35
Show Gist options
  • Select an option

  • Save knil-sama/e0fdd159a4c384601d1293f7b91eb2ea to your computer and use it in GitHub Desktop.

Select an option

Save knil-sama/e0fdd159a4c384601d1293f7b91eb2ea to your computer and use it in GitHub Desktop.
import boto3
import sys
prefix = sys.argv[1]
client = boto3.client('cloudwatch',region_name='eu-west-1')
response = client.describe_alarms(
AlarmNamePrefix = prefix,
StateValue = 'INSUFFICIENT_DATA',
)
alarms = response['MetricAlarms']
alarm_names = [alarm['AlarmName'] for alarm in alarms]
print alarm_names[0]
response1 = client.delete_alarms(
AlarmNames = alarm_names
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment