Skip to content

Overly broad region state check in cloudwatch-logs-cleanup.sh #23

Description

@nnamtug

Hey

Just a quick note on this line:

if echo "$AWSregions" | egrep -iq "error|not"; then

According to the AWS CLI docs for describe-regions, region states include:

  • opt-in-not-required
  • opted-in
  • not-opted-in

If the intention is to filter out only not-opted-in regions, the current check egrep -iq "error|not" may be a bit too broad—it could accidentally match opt-in-not-required, which seems like a valid region.

Maybe something like this would be more accurate?

if echo "$AWSregions" | egrep -iq "error|not-opted-in"; then

Just a small suggestion—great script otherwise!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions