This Bash script helps you delete multiple log groups in a specified AWS region using AWS CLI.
- You need to have AWS CLI installed and configured on your system.
- Make sure you have the necessary IAM permissions to delete log groups.
./delete-cw-log-groups.sh
The script will prompt you to enter the AWS region for which you want to delete the log groups. The default region is ap-southeast-2
. After entering the region, the script will display the log groups that will be deleted, and you will be asked to confirm the deletion.
- AWS region: You can either enter the region when prompted or change the default region by editing the script.
The script performs the following actions:
- Prompts the user to enter the AWS region (default is
ap-southeast-2
). - Retrieves the log group names for the specified region.
- Displays the log groups that will be deleted and the total number of log groups.
- Asks the user to confirm the deletion.
- Deletes the log groups one by one, displaying the status for each deletion (OK or Fail).
Feel free to contact me on Twitter, DEV Community or LinkedIn if you have any questions or suggestions.
Or just visit my website to see what I do.