To clean alarms generated through CloudWatch

0

Hi friends,

What is the easiest way to remove alarms generated through CloudWatch? My "Cost and Usage Report" through the Cost Explorer still shows cost with the name "USW2-CW:AlarmMonitorUsage". I searched to get rid of it in the knowledge base, but all seemed to be a bit complicated for me. Is there a simplest way to get rid of it? Many many thanks in advance!!

  • please accept the answer if it was helpful

질문됨 9달 전260회 조회
3개 답변
0

Hi friend. I have created a file as per the instruction given and executed it. The amazing thing is that I got the echoed text message "All alarms deleted." without any error. I hope this has cleared all unnecessary alarms, and my slate is be clean now :D. Many many thanks for the help and providing a script which works without error. Adios!

답변함 9달 전
  • Happy to help. Please accept my answer

0

Example: Bash Script to Delete All Alarms

#!/bin/bash

# List all alarm names
alarms=$(aws cloudwatch describe-alarms --query "MetricAlarms[].AlarmName" --output text)

# Delete each alarm
for alarm in $alarms; do
  echo "Deleting alarm: $alarm"
  aws cloudwatch delete-alarms --alarm-names "$alarm"
done

echo "All alarms deleted."

Make the script executable:

chmod +x delete_alarms.sh

Run the script:

./delete_alarms.sh
profile picture
전문가
답변함 9달 전
전문가
검토됨 9달 전
0

Hello friend,

Sorry for returning with the same. When I look at the services I can still see AmazonCloudWatch showing "Current usage = 10 Alarms" and "Forecasted usage = 14 Alarms". Does this mean still there are some alarms in the system? how can I see them and get rid of those Alarms? Many thanks!

답변함 9달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인