Skip to content

Instantly share code, notes, and snippets.

@makash
Last active November 7, 2019 03:06
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 makash/0d969155e2f4de04bae5267f2f1c8a3c to your computer and use it in GitHub Desktop.
Save makash/0d969155e2f4de04bae5267f2f1c8a3c to your computer and use it in GitHub Desktop.
A Cloud Custodian policy file that finds S3 buckets which are public and makes them private if they match certain tag filters
policies:
- name: s3-remove-public-access
description: |
Finds global access s3 buckets in your account and fix them
resource: s3
region: us-east-1
filters:
- type: global-grants
- type: value
key: "tag:createdby"
value: "automation"
- not:
- type: value
key: "tag:type"
value: "static-site"
actions:
- type: delete-global-grants
grantees:
- "http://acs.amazonaws.com/groups/global/AllUsers"
- "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment