Weekly Amazon S3 bucket security audit posted to Slack
Every Monday, check every S3 bucket for public exposure, missing encryption and weak backup settings, then get the risks ranked in Slack.
Every Monday at 8am, audit the security posture of every bucket in my Amazon S3 account and report the risks to my team in Slack. Use a cron trigger for the schedule.
Start with List Buckets to enumerate every bucket in the account. Then, for each bucket, read Get Public Access Block, Get Bucket Policy Status, Get Bucket Policy, Get Bucket Encryption, Get Bucket Versioning, Get Bucket Logging and Get Bucket Ownership Controls.
Judge each bucket against this safe baseline: public access fully blocked with all four Block Public Access settings enabled, default encryption on, versioning enabled, server access logging on, and a bucket policy containing no statement that grants access to a wildcard principal and no statement that permits plain HTTP instead of requiring secure transport. Object Ownership set to BucketOwnerEnforced is the safe setting, because it disables ACLs as a second route to public access.
Keep this workflow strictly read only. Never call any Put or Delete operation, even when a fix looks obvious. The report recommends and the human decides.
Treat a missing configuration as a finding rather than an error. S3 returns NoSuchBucketPolicy, ServerSideEncryptionConfigurationNotFoundError or NoSuchPublicAccessBlockConfiguration when a setting was simply never configured, which is exactly the risk worth flagging. Catch those specific errors, record them as findings, and carry on to the next check instead of failing the run.
Grade every finding so the report can be ordered worst first. Critical means the bucket is actually reachable by the public, either because the policy status reports it as public or because the policy grants a wildcard principal without a condition that meaningfully restricts it. High means missing default encryption, an incomplete Block Public Access configuration, or a policy that allows plain HTTP. Medium means versioning off, server access logging off, or ACLs still enabled. A bucket's overall severity is that of its worst finding.
List Buckets returns buckets from every region, but the credential carries a single region, so a bucket outside that region returns 301 PermanentRedirect. When that happens, read the correct region from the x-amz-bucket-region response header, which Head Bucket also returns, and retry that bucket against its real region. Never drop a bucket silently. A bucket that still cannot be read after the retry is an unaudited bucket, so report it under a could not check heading rather than counting it as passing.
Post one Slack message using the Slack Bot Send a Message operation, so the report comes from a bot identity rather than from me personally. List only the buckets that fail, ordered worst first, with one plain sentence per bucket saying what is wrong and why it matters, for example that a bucket is readable by anyone on the internet and could leak whatever is stored in it. Write for someone who is not an AWS expert: no operation names and no raw policy JSON. Put any could not check buckets in a short section at the end. If nothing fails, post a single all clear line naming how many buckets were scanned, so the team knows the audit ran.
Then append one row per run to my Google Sheets audit log with Append Values, recording the run date, how many buckets were scanned, how many failed, the count of findings at critical, high and medium, and how many buckets could not be checked. Use USER_ENTERED so the date lands as a real date. Always append and never overwrite earlier rows, so the trend is visible over time and the sheet doubles as evidence for compliance reviews.
What does this prompt do?
- Every Monday morning, reviews every bucket in your Amazon S3 account and checks whether it is exposed to the public internet, unencrypted, or missing backup protection.
- Posts one Slack message to your team listing only the buckets that need attention, worst first, with a plain sentence each explaining what is wrong and why it matters.
- Sends an all clear line when every bucket passes, so you always know the check actually ran and did not quietly fail.
- Adds a row each week to a Google Sheet recording the date, how many buckets were checked and how many problems were found, giving you a trend line and a record for compliance reviews.
What do I need to use this?
- An Amazon Web Services login with permission to view your S3 storage settings
- A Slack workspace and a channel where the weekly report should be posted
- A Google Sheet to hold the audit log, with a tab ready to receive one row per week
How can I customize it?
- Change the day and time, for example daily during a security push and monthly once things are stable
- Choose which Slack channel gets the report, or send it as a direct message to whoever owns storage
- Adjust the standard buckets are measured against, such as accepting missing version history on temporary scratch buckets
- Exclude buckets that are public on purpose, like one serving a public website, so they stop showing up as problems
FAQs
Will this change anything in my AWS account?
Does it cover buckets in more than one region?
Do I need to be technical to read the report?
What if a bucket was never configured with these settings at all?
Does this replace a proper security review?
Related templates
When someone leaves, we check which shared passwords they used in their final months and post a ranked rotation list to your security channel.
Twice every weekday, the conversations from your social inbox land on the right HubSpot contact timelines, with a Slack recap for sales.
Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.
Every morning, find the addresses that hard bounced or filed a spam complaint, update the matching HubSpot contacts, and post a short Slack recap.
Every weekday at 4pm, spot the threads that went quiet, stage a ready-to-send nudge in your mailbox, and get a ranked Slack recap.
When you merge a fix in GitHub, this agent checks the matching dead-letter queue, replays the failed messages, and reports back on the pull request and in Slack.
Stop guessing which S3 buckets are exposed.
Get a ranked, plain English list of every bucket that needs attention in Slack each Monday, plus a running log for your next compliance review.