AwsCLI icon
If icon
SlackIncomingWebhook icon
Log icon
Schedule icon

AWS S3 Account Public Access Block Configuration Drift Sentinel

Continuously audit your AWS account-level S3 public access block settings and alert Slack if any protection is disabled.

Categories
CloudInfrastructure

This sentinel runs on a schedule to verify that all four AWS account-level S3 public access block settings are enabled: BlockPublicAcls, IgnorePublicAcls, BlockPublicPolicy, and RestrictPublicBuckets. If any setting has drifted to false, a Slack alert fires immediately with the exact flags that are misconfigured.

How it works

  1. io.kestra.plugin.aws.cli.AwsCLI calls aws sts get-caller-identity to resolve the current account ID, then calls aws s3control get-public-access-block to retrieve the four block flags for that account.
  2. A shell conditional evaluates each flag. If all four are true, drift_detected is set to false; otherwise it is set to true and each individual flag value is emitted as a variable.
  3. io.kestra.plugin.core.flow.If branches on drift_detected. When true, a Slack alert lists the exact misconfigured flags. When false, the flow logs a clean health message and exits.
  4. A top-level errors block fires a Slack alert if the AWS CLI or any other task throws an unhandled exception.

What you get

  • Automated detection of account-level S3 public access block drift every 15 minutes.
  • Precise per-flag Slack notifications identifying exactly which settings are disabled.
  • A top-level error handler that surfaces execution failures without silent failures.
  • A fully auditable execution history in Kestra for every sentinel check.

Who it's for

  • Security engineers enforcing AWS S3 data-exposure controls.
  • Cloud platform teams running CIS AWS benchmark compliance programmes.
  • DevOps teams that need automated drift detection without a dedicated CSPM tool.

Why orchestrate this with Kestra

AWS Config can flag this rule, but it requires a separate service, rule set, and notification pipeline. Kestra consolidates the check, the conditional logic, and the Slack alert into a single declarative flow with full execution lineage, retries, and namespace-scoped secret management, no additional infrastructure required.

Prerequisites

  • An AWS IAM identity with s3control:GetPublicAccessBlock and sts:GetCallerIdentity permissions.
  • A Slack incoming webhook.

Secrets

  • AWS_ACCESS_KEY_ID: AWS access key ID.
  • AWS_SECRET_ACCESS_KEY: AWS secret access key.
  • SLACK_WEBHOOK: Slack incoming webhook URL.

Quick start

  1. Add AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and SLACK_WEBHOOK to your Kestra namespace secrets.
  2. Set the aws_region input to your target region (default: us-east-1).
  3. Enable the schedule trigger or execute manually to verify the current account state.

How to extend

  • Loop over multiple AWS accounts by storing account IDs as a Kestra variable and using ForEach.
  • Add automated remediation by calling aws s3control put-public-access-block when drift is detected.
  • Route critical findings to PagerDuty or OpsGenie in addition to Slack.
  • Persist results to a database or S3 for long-term compliance trend analysis.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.