Skip to content

Instantly share code, notes, and snippets.

@xavier-thomas
Last active August 25, 2021 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xavier-thomas/460220105ec84742ab0a8ad339af9f18 to your computer and use it in GitHub Desktop.
Save xavier-thomas/460220105ec84742ab0a8ad339af9f18 to your computer and use it in GitHub Desktop.
AWS delete all CloudWatch Log Groups
# This command will lets you find and delete all Cloudwatch log groups in an AWS Account.
# You need to have assumed the permissions to run the command before the following can be run.
# Alternatively, pass in the --profile <aws-profile-name> in the AWS commands to obtain permission.
aws logs describe-log-groups --query logGroups[].logGroupName |\
while read logGroup
do
TEMP=$(sed -e 's/,$//' -e 's/^"//' -e 's/"$//' <<<"${logGroup}")
aws logs delete-log-group --log-group-name $TEMP
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment