https://github.com/antoonline/bash-script-aws-cloudwatch-delete-log-groups
This script automates the process of deleting AWS CloudWatch log groups in a specified region. It retrieves the list of log groups, prompts the user for confirmation, and then deletes them one by one. Ideal for cleaning up unnecessary log groups and reducing storage costs.
https://github.com/antoonline/bash-script-aws-cloudwatch-delete-log-groups
aws bulk-delete cloudwatch log-groups
Last synced: 3 months ago
JSON representation
This script automates the process of deleting AWS CloudWatch log groups in a specified region. It retrieves the list of log groups, prompts the user for confirmation, and then deletes them one by one. Ideal for cleaning up unnecessary log groups and reducing storage costs.
- Host: GitHub
- URL: https://github.com/antoonline/bash-script-aws-cloudwatch-delete-log-groups
- Owner: AntoOnline
- Created: 2023-04-29T19:57:49.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-30T23:34:25.000Z (about 2 years ago)
- Last Synced: 2025-01-14T08:14:15.654Z (4 months ago)
- Topics: aws, bulk-delete, cloudwatch, log-groups
- Language: Shell
- Homepage: https://anto.online
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AWS Log Group Deletion Script
This Bash script helps you delete multiple log groups in a specified AWS region using AWS CLI.
## Prerequisites
1. You need to have [AWS CLI](https://aws.amazon.com/cli/) installed and configured on your system.
2. Make sure you have the necessary IAM permissions to delete log groups.## Usage
```
./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.
### Options
- AWS region: You can either enter the region when prompted or change the default region by editing the script.
## Description
The script performs the following actions:
1. Prompts the user to enter the AWS region (default is `ap-southeast-2`).
2. Retrieves the log group names for the specified region.
3. Displays the log groups that will be deleted and the total number of log groups.
4. Asks the user to confirm the deletion.
5. Deletes the log groups one by one, displaying the status for each deletion (OK or Fail).## Want to connect?
Feel free to contact me on [Twitter](https://twitter.com/OnlineAnto), [DEV Community](https://dev.to/antoonline/) or [LinkedIn](https://www.linkedin.com/in/anto-online) if you have any questions or suggestions.
Or just visit my [website](https://anto.online) to see what I do.