- 最新
- 最多得票
- 最多評論
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!
Happy to help. Please accept my answer
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
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!
相關內容
- 已提問 2 個月前
- 已提問 4 個月前
- 已提問 7 個月前
- AWS 官方已更新 3 年前
- AWS 官方已更新 2 年前
- AWS 官方已更新 2 個月前
- AWS 官方已更新 3 年前
please accept the answer if it was helpful