Redact AWS Access Keys and Secrets

Automatically detect and redact AWS access key IDs and secret access keys from configuration files, CLI output, and environment variables before sharing.

Secret Types

Detailed Explanation

Redacting AWS Credentials

AWS credentials are among the most dangerous secrets to leak. An exposed AWS access key and secret key pair can grant an attacker full access to your cloud infrastructure, potentially resulting in massive compute charges, data exfiltration, or resource destruction.

AWS Credential Formats

AWS uses two primary credential types that appear in text:

Access Key ID — Always starts with AKIA followed by 16 uppercase alphanumeric characters:

AKIAIOSFODNN7EXAMPLE

Secret Access Key — A 40-character Base64-encoded string:

wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Where AWS Credentials Appear

Credentials frequently surface in these locations:

  • ~/.aws/credentials — The AWS CLI configuration file
  • Environment variablesAWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  • Docker Compose files — Passed as environment variables to containers
  • Terraform state files — Can contain provisioned IAM credentials
  • CloudFormation templates — Hardcoded keys in resource definitions
  • CI/CD pipeline logs — Accidentally printed during build steps
# Before redaction
[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

# After redaction
[default]
aws_access_key_id = [REDACTED_AWS_KEY]
aws_secret_access_key = [REDACTED_AWS_SECRET]

Detection Reliability

The AKIA prefix makes AWS access key IDs highly reliable to detect with zero false positives. Secret access keys are harder because their format overlaps with other Base64 strings, but when found near an access key ID or AWS-related context, confidence increases significantly.

Immediate Actions After a Leak

If you suspect an AWS key has been exposed: rotate the key immediately in the IAM console, review CloudTrail logs for unauthorized activity, and consider enabling AWS GuardDuty for ongoing monitoring.

Use Case

An infrastructure engineer is preparing a runbook for their team and needs to include sample AWS CLI configuration. They paste the real config into the Secret Redactor to strip all access keys and secrets, then replace the redacted placeholders with clearly marked example values before publishing the runbook.

Try It — Secret Redactor

Open full tool