New to Kestra?
Use blueprints to kickstart your first workflows.
Audit AWS Config rules for NON_COMPLIANT status and alert Slack with the exact rule names before drift goes unnoticed.
AWS Config evaluates every configured rule continuously, but it has no built-in way to say "notify this Slack channel the moment any rule goes NON_COMPLIANT" without wiring an EventBridge rule and a notification target per account - a separate configuration surface from the flow that actually needs to react. This blueprint runs Config's own compliance query, filtered server-side, and alerts Slack directly with the exact rule names and resource counts.
periodic_compliance_check (io.kestra.plugin.core.trigger.Schedule) runs every 6 hours, explicitly passing aws_region through its own inputs: block so the flow is self-contained when the trigger fires. Shipped disabled so a manual run can be verified first.probe_config_compliance (io.kestra.plugin.aws.cli.AwsCLI) runs aws configservice describe-compliance-by-config-rule --compliance-types NON_COMPLIANT, capturing the result's ComplianceByConfigRules list (and NextToken) as named task outputs via the plugin's own documented output-echo convention.evaluate_compliance (io.kestra.plugin.core.flow.If) branches on whether that list has any entries at all.then (NON_COMPLIANT_RULES_DETECTED): alert_non_compliant_rules reports every non-compliant rule's name and capped non-compliant-resource count to Slack.else (HEALTHY): log_all_rules_compliant records a clean sweep.log_audit_complete always runs last, printing the non-compliant rule count regardless of which branch fired.errors block alerts Slack separately if the flow itself fails outright - AWS Config not being enabled in the region, or bad credentials, must not read as HEALTHY.io.kestra.plugin.aws.cli.AwsCLI driving a read-only compliance audit via a plain aws configservice CLI call, reusing the same output-capture convention as this repository's CloudFormation stuck-stack sentinel blueprint, with the same deliberate fix (newlines only, not spaces, stripped before the marker) so rule names and messages are never corrupted.AwsCLI used for a read-only governance audit rather than a provisioning command.AWS Config itself has no cross-account, cross-rule "tell me the moment anything goes NON_COMPLIANT" primitive beyond what you wire up separately in EventBridge and SNS, configuration that then has to be kept in sync as rules are added or removed. Kestra supplies the schedule, the HEALTHY/NON_COMPLIANT_RULES_DETECTED classification as a first-class branch, and an execution history that shows exactly when drift was introduced and which rules and resources were affected.
aws_region).config:DescribeComplianceByConfigRule permission - entirely read-only, cannot modify any rule or resource.This blueprint has no meaningful local testing path. LocalStack now requires its own account and auth token as of March 2026, and even where LocalStack is used, its own documentation describes AWS Config's compliance evaluation as inert - describe-compliance-by-config-rule always returns INSUFFICIENT_DATA there rather than evaluating against real resource configuration. A real AWS account with Config actually enabled is the only way to exercise this blueprint meaningfully.
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY: credentials for io.kestra.plugin.aws.cli.AwsCLI.SLACK_WEBHOOK_URL: Slack incoming webhook used by alert_non_compliant_rules and the errors block.SECRET_, base64-encoded - for example SECRET_AWS_SECRET_ACCESS_KEY=$(echo -n '<your-secret-key>' | base64) - and read back in flows with {{ secret('NAME') }}.aws_region (STRING, default us-east-1): region whose Config rules are audited.outputs.probe_config_compliance.vars.ComplianceByConfigRules: the list of non-compliant rules, each with ConfigRuleName and Compliance.ComplianceContributorCount.CappedCount / CapExceeded (verified fields from AWS Config's own DescribeComplianceByConfigRule API reference).outputs.probe_config_compliance.vars.NextToken: pagination token, present when more non-compliant rules exist than fit in one page - not consumed by this blueprint (see Pitfalls).s3-bucket-public-read-prohibited).AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and SLACK_WEBHOOK_URL secrets.log_all_rules_compliant fires.alert_non_compliant_rules fires with the real rule name and resource count.periodic_compliance_check once you trust the check against your real account.aws_region values with io.kestra.plugin.core.flow.Loop to audit every region where Config is enabled in one run.NextToken with a follow-up AwsCLI call using --starting-token if an account has enough non-compliant rules to paginate - this blueprint's single call only sees the first page.--compliance-types NON_COMPLIANT does not surface INSUFFICIENT_DATA rules (rules that have not been evaluated yet) - a rule can sit silently unevaluated and this blueprint will not flag it, since it is checking only for active non-compliance, not evaluation coverage.describe-compliance-by-config-rule page, NextToken will be present in the output but this blueprint does not follow it - see How to extend.tr -d '\n' | xargs -0 -I {} echo '::{"outputs":{}}::') deliberately does not strip spaces, unlike the plugin's own Javadoc example, for the same reason documented in this repository's CloudFormation stuck-stack sentinel: stripping spaces would corrupt any rule name or message containing them.describe-compliance-by-config-rule there always returns INSUFFICIENT_DATA regardless of actual resource state, on top of LocalStack now requiring its own account since March 2026. Neither issue is specific to this blueprint; both are disclosed here so they are not mistaken for a bug in it.--compliance-types filter, and the ComplianceByConfigRules / Compliance.ComplianceContributorCount output fields are taken verbatim from AWS's own CLI and API reference documentation - but no Kestra engine was run to execute this flow end to end.