What is AWS SafeBox?
AWS SafeBox is a local policy layer for AI coding agents and people doing AI-assisted infrastructure work. It sits between command-line tools such as Terraform, the AWS CLI, and kubectl, allowing permitted commands to run while stopping commands that match a blocking rule. The Community Edition is an additional guardrail, not a hardened sandbox or a replacement for IAM, backups, or other AWS security controls.
AWS SafeBox Features:
Command Checks: Check a command against policy without executing it, and see whether it is allowed or blocked.
Policy-Enforced Runs: Run a command through SafeBox so the policy is evaluated before an allowed command reaches its executable.
Executable Proxies: Create proxies for Terraform, the AWS CLI, and kubectl that intercept commands resolved through PATH.
Default Rules: The default policy blocks Terraform destroy, kubectl delete, selected EC2 and RDS deletions, recursive S3 removal, and CloudFormation stack deletion.
Custom TOML Policies: Write local TOML rules with command patterns and optional argument requirements, then provide a policy file for checks or runs.
Fail-Closed Evaluation: SafeBox blocks unsupported shell syntax it cannot evaluate and can assess supported compound commands joined with &&, ||, or semicolons.
AWS SafeBox Benefits:
Earlier Intervention: A destructive command that matches a blocking rule is stopped before it reaches the real infrastructure tool.
Fewer Manual Steps: PATH-based proxies let compatible software invoke protected tools with their usual commands, without wrapping each one in a SafeBox run command.
Clearer Boundaries: Explicit local rules make it possible to distinguish permitted planning and read operations from selected destructive actions.
Safer Evaluation: Command checks give teams a way to inspect a proposed command’s policy result without running it.
Local Control: Custom policies let infrastructure teams define command restrictions suited to their own local workflows.
Use Cases:
AI Terraform Work: Put a policy check in front of an AI agent that can run Terraform, allowing plan commands while blocking terraform destroy.
AWS CLI Guardrails: Add a local check before agent-issued EC2 termination, RDS deletion, recursive S3 removal, or CloudFormation stack deletion commands.
Kubernetes Changes: Use a proxy to stop kubectl delete commands before they reach the real Kubernetes executable.
Command Review: Check a proposed infrastructure command before execution when reviewing an agent’s planned action or a shell command.
Team Policy Setup: Create TOML rules for an infrastructure workflow and place SafeBox’s proxy directory ahead of real tools in PATH.

