Created
July 25, 2024 14:56
-
-
Save Yehonal/9ce5a1fd7f8b5417cc7e511b3f292b68 to your computer and use it in GitHub Desktop.
How to close AWS incidents in bulk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the AWS region | |
REGION="eu-west-1" | |
PROFILE="your-aws-cli-profile" | |
aws ssm-incidents list-incident-records --region $REGION --profile $PROFILE | jq -r '.incidentRecordSummaries[] | select(.status != "RESOLVED") | .arn' >incident_ids.txt | |
while read incident_id; do | |
aws ssm-incidents update-incident-record --region $REGION --arn $incident_id --status "RESOLVED" --profile $PROFILE | |
echo "Incident $incident_id has been closed." | |
done <incident_ids.txt | |
echo "All unresolved incidents have been closed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment