AWS CLI
cloud.aws
Protects against destructive AWS CLI operations like terminate-instances, delete-db-instance, s3 rm --recursive, Athena/Glue catalog deletions, and destructive Athena queries (DROP, TRUNCATE, DELETE without WHERE)
- 41blocking rules
- 11safe patterns
- 21Critical
- 16High
- 4Medium
[packs]
enabled = ["cloud.aws"]Evaluated when a command contains aws, terminate, delete, s3, ec2, rds, ecr, logs, athena, glue.
Recorded verdicts
aws s3 rb s3://prod-backups --forceBlockedcloud.aws:s3-rbaws ec2 terminate-instances --instance-ids i-0abc123Blockedcloud.aws:ec2-terminate
Blocking rules
Each rule ID is cloud.aws:<name>. Use it in allowlists and [policy.rules].
Criticalathena-delete-data-catalogaws athena delete-data-catalog removes the data catalog and all database/table definitions tied to it.
Explanation
delete-data-catalog detaches and removes an Athena DataCatalog: - All databases and table definitions linked to the catalog are lost - Queries referencing this catalog will fail - Underlying S3 data is NOT deleted, but becomes unreadable via Athena - Cannot be undone (catalog metadata is gone) List catalogs first: aws athena list-data-catalogs aws athena get-data-catalog --name xxx
Criticalathena-query-delete-without-whereAthena DELETE without a WHERE clause removes all rows from the target table.
Explanation
DELETE FROM <table> without a WHERE clause: - Every row in the table is deleted - Iceberg tables: underlying S3 data is dropped - Hive tables: operation fails (Athena rejects unscoped DELETE on Hive) - Cannot be undone (no automatic snapshots) Rewrite with a WHERE clause that scopes the deletion: DELETE FROM db.table WHERE <predicate>
Criticalathena-query-drop-databaseAthena DROP DATABASE/SCHEMA removes the database from the Glue catalog.
Explanation
DROP DATABASE/SCHEMA removes a database from the Glue catalog: - All table definitions inside the database are lost - Queries referencing this database will fail - Underlying S3 data is NOT deleted, just unreadable via Athena - Cannot be undone (catalog metadata lost) List tables first: aws athena start-query-execution \ --query-string 'SHOW TABLES IN database_name' For more control, use `aws glue delete-database` (which this pack also blocks).
Criticalathena-query-truncateAthena TRUNCATE TABLE deletes all rows from an Iceberg table.
Explanation
TRUNCATE TABLE in Athena (Iceberg tables): - All rows are deleted from the table - The table definition is preserved - Underlying S3 objects are removed for Iceberg tables - Cannot be undone (no implicit snapshot retention) Consider a targeted DELETE with WHERE clause instead.
Criticalcfn-delete-stackaws cloudformation delete-stack removes the entire stack and its resources.
Explanation
CloudFormation delete-stack removes the stack AND all resources it created: - EC2 instances terminated - RDS databases deleted (unless DeletionPolicy: Retain) - S3 buckets removed (if empty) - All IAM resources deleted Resources with DeletionPolicy: Retain are kept but orphaned. Preview resources: aws cloudformation describe-stack-resources --stack-name xxx Consider: aws cloudformation delete-stack --retain-resources res1 res2
Criticalcloudtrail-delete-trailaws cloudtrail delete-trail removes an audit trail — compliance/forensics impact.
Explanation
delete-trail removes a CloudTrail trail: - Trail configuration is deleted - Historical log files in S3 are NOT deleted (still queryable) - Future events stop being recorded via this trail - Compliance regimes (SOC2, PCI, HIPAA) may require this trail Consider stop-logging if pausing is sufficient: aws cloudtrail stop-logging --name xxx
Criticaldynamodb-deleteaws dynamodb delete-table permanently deletes the table and all data.
Explanation
delete-table removes a DynamoDB table and ALL its data: - All items are deleted - Table configuration is lost - Global secondary indexes deleted - Cannot be undone Backup first: aws dynamodb create-backup --table-name xxx --backup-name backup Or export to S3: aws dynamodb export-table-to-point-in-time ...
Criticalec2-terminateaws ec2 terminate-instances permanently destroys EC2 instances.
Explanation
terminate-instances permanently destroys EC2 instances: - Instance is stopped and deleted - Instance store volumes are lost - EBS root volumes deleted (unless DeleteOnTermination=false) - Elastic IPs are disassociated This cannot be undone. The instance ID will never be reusable. Preview first: aws ec2 describe-instances --instance-ids i-xxx Consider stop instead: aws ec2 stop-instances --instance-ids i-xxx
Criticalefs-delete-file-systemaws efs delete-file-system destroys an EFS filesystem — all files and mount targets are lost.
Explanation
delete-file-system removes an EFS filesystem: - All files in the filesystem are permanently deleted - Mount targets and access points are removed - Cannot be undone (no built-in recovery) - Take a backup first via AWS Backup or rsync out: aws backup start-backup-job --backup-vault-name xxx \ --resource-arn arn:aws:elasticfilesystem:...:file-system/fs-xxx \ --iam-role-arn arn:aws:iam::...:role/backup-role
Criticaleks-deleteaws eks delete-cluster removes the entire EKS cluster.
Explanation
delete-cluster removes an EKS cluster: - Control plane is deleted - Node groups must be deleted separately first - Kubernetes resources (deployments, services) are lost - Persistent volumes may remain as orphaned EBS Delete node groups first: aws eks list-nodegroups --cluster-name xxx aws eks delete-nodegroup --cluster-name xxx --nodegroup-name yyy Then delete cluster.
Criticalglue-batch-delete-tableaws glue batch-delete-table removes multiple table definitions in one call.
Explanation
batch-delete-table drops several Glue tables in one API call: - All listed table definitions are lost - Underlying S3 data is preserved - Queries referencing these tables will fail - Cannot be undone Review the exact names first: aws glue get-tables --database-name xxx
Criticalglue-delete-databaseaws glue delete-database removes the database and every table definition inside it.
Explanation
delete-database drops a Glue database and every table/partition in it: - All table definitions in the database are lost - Athena / EMR / Redshift Spectrum queries referencing these tables will fail - Underlying S3 data is preserved, but becomes unreadable via the catalog - Cannot be undone (metadata is gone) List tables first: aws glue get-tables --database-name xxx
Criticalkinesis-delete-streamaws kinesis delete-stream destroys a data stream — in-flight records are lost.
Explanation
delete-stream removes a Kinesis data stream: - All shards, consumers, and in-flight records are lost - Producers and consumers disconnect immediately - Data retained only as long as EnhancedMonitoring/FanOut sinks preserved it - Stream name is reserved briefly; re-creation may fail until it clears
Criticalkms-schedule-key-deletionaws kms schedule-key-deletion schedules a KMS key for irreversible deletion — all data encrypted with it becomes unreadable.
Explanation
schedule-key-deletion starts an irreversible KMS key destruction: - After the waiting period (min 7 days), the key is deleted - Every piece of data encrypted under this key becomes permanently undecryptable - CancelKeyDeletion can abort within the waiting window - After deletion: data loss is unrecoverable Prefer `disable-key` if you want to stop usage reversibly: aws kms disable-key --key-id xxx
Criticalrds-deleteaws rds delete-* permanently destroys the database resource (instance, cluster, snapshot, parameter group, subnet group, etc.).
Explanation
RDS delete commands permanently remove database resources: - delete-db-instance: Destroys the database instance - delete-db-cluster: Destroys Aurora cluster - delete-db-snapshot: Removes backup - delete-db-cluster-snapshot: Removes cluster backup Consider: - Create final snapshot before deletion - Skip final snapshot only for test instances Create backup: aws rds create-db-snapshot --db-instance-id xxx --db-snapshot-id backup
Criticalredshift-delete-clusteraws redshift delete-cluster destroys a Redshift cluster and all loaded data.
Explanation
delete-cluster removes a Redshift cluster: - With --skip-final-cluster-snapshot: ALL data is destroyed immediately - Without --skip-final-cluster-snapshot: cluster deleted after final snapshot - Connected BI tools, ETL pipelines, and downstream jobs break - Very expensive to restore (hours of snapshot restore) Preview: aws redshift describe-clusters --cluster-identifier xxx
Criticalroute53-delete-hosted-zoneaws route53 delete-hosted-zone removes a DNS zone — domains stop resolving.
Explanation
delete-hosted-zone removes a Route53 hosted zone: - All DNS records in the zone are deleted - Domains configured with this zone's nameservers stop resolving - Production traffic can become unroutable immediately - Cannot be undone Export records first: aws route53 list-resource-record-sets --hosted-zone-id xxx > zone-backup.json
Criticals3-rbaws s3 rb removes the entire S3 bucket.
Explanation
s3 rb removes an S3 bucket: - Bucket must be empty (use --force to delete contents first) - With --force: deletes all objects then bucket - Bucket name becomes available for others - Cannot be undone Check bucket contents: aws s3 ls s3://bucket --recursive --summarize Verify bucket name: aws s3api head-bucket --bucket bucket-name
Criticals3-rm-recursiveaws s3 rm --recursive permanently deletes all objects in the path.
Explanation
s3 rm --recursive deletes ALL objects under the specified path: - All files and 'folders' are deleted - Versioned objects: only current version deleted - No trash/recycle bin - Cannot be undone (unless versioning enabled) Preview what would be deleted: aws s3 ls s3://bucket/path/ --recursive aws s3 rm s3://bucket/path/ --recursive --dryrun Consider versioning for recovery: aws s3api list-object-versions --bucket bucket
Criticals3api-delete-bucketaws s3api delete-bucket removes the entire S3 bucket.
Explanation
s3api delete-bucket removes a bucket (must be empty): - Returns error if bucket not empty - Bucket name released for reuse by anyone - Associated policies and configurations lost Empty bucket first if needed: aws s3 rm s3://bucket --recursive Or use s3 rb --force for both operations.
Criticalsecretsmanager-delete-secretaws secretsmanager delete-secret destroys a stored secret — typically irrecoverable credentials.
Explanation
delete-secret removes a Secrets Manager secret: - Default 30-day recovery window unless --force-delete-without-recovery - With --force-delete-without-recovery: immediate & unrecoverable - All rotation history, versions, and values are lost - Credentials for production services can become unrecoverable if not backed up Restore during the recovery window: aws secretsmanager restore-secret --secret-id xxx
Highathena-cli-input-fileAthena --cli-input-json/yaml loaded from file:// or fileb:// — content is opaque to the guard.
Explanation
`--cli-input-json file://…` (or `-yaml`) supplies the whole invocation — including QueryString — from a file on disk. DCG only greps the command line, so a DROP or TRUNCATE buried in the JSON/YAML body on disk slips past every other Athena rule. Inline JSON/YAML (e.g. `--cli-input-json '{…}'`) is still allowed because DCG can read the literal in the command line and catch a DROP there. Prefer explicit `--query-string '…'`, or inline the JSON blob. If the file-backed form is genuinely required, allowlist this rule with a justification.
Highathena-delete-work-groupaws athena delete-work-group removes the Athena workgroup and its configuration.
Explanation
delete-work-group removes an Athena workgroup: - Query history, IAM-scoped configuration, and cost controls are lost - In-flight queries are cancelled - With --recursive-delete-option, named queries in the workgroup are also dropped Preview first: aws athena get-work-group --work-group xxx
Highathena-query-drop-tableAthena DROP TABLE/VIEW removes the table definition from the Glue catalog.
Explanation
DROP TABLE/VIEW removes a table or view from the catalog: - Table definition is lost - Queries referencing this table will fail - Underlying S3 data is NOT deleted Preview schema first: aws athena start-query-execution \ --query-string 'SHOW CREATE TABLE db.table'
Highathena-query-string-from-fileAthena --query-string loaded from file:// or fileb:// — SQL content is opaque to the guard.
Explanation
Athena `start-query-execution --query-string file://…` loads the SQL from disk, so DCG can't inspect the statement. The file may contain DROP DATABASE, TRUNCATE TABLE, or an unscoped DELETE. Prefer the inline form so the guard can see what you're running: aws athena start-query-execution \ --query-string 'SELECT … FROM …' If a file-loaded query is genuinely required, cat it first so the content is inspectable, and allowlist this rule in your project DCG config with a justification.
Highecr-batch-delete-imageaws ecr batch-delete-image permanently deletes one or more images.
Explanation
batch-delete-image removes specific images from ECR: - Images are permanently deleted - Can delete by tag or digest - Running containers using these images may fail on restart List images: aws ecr describe-images --repository-name xxx Verify image usage before deletion.
Highecr-delete-repositoryaws ecr delete-repository permanently deletes the repository and its images.
Explanation
delete-repository removes an ECR repository: - All images in the repository are deleted - Repository configuration lost - Requires --force if repository not empty List images first: aws ecr list-images --repository-name xxx Consider keeping critical images: docker pull <account>.dkr.ecr.<region>.amazonaws.com/repo:tag
Highglue-batch-delete-partitionaws glue batch-delete-partition removes multiple partition definitions in one call.
Explanation
batch-delete-partition drops several Glue partitions at once: - Every listed partition's metadata is lost - Underlying S3 data is preserved - Recreate via `aws glue batch-create-partition` if you still have the list
Highglue-delete-jobaws glue delete-job removes the ETL job definition and all of its run history.
Explanation
delete-job removes a Glue ETL job: - Job script reference, connections, arguments, and schedule are lost - All run history and metrics for the job are removed - Scheduled triggers referencing the job will fail Export the job definition first: aws glue get-job --job-name xxx > job-backup.json
Highglue-delete-partitionaws glue delete-partition removes partition metadata; the partition is no longer queryable until recreated.
Explanation
delete-partition removes a Glue partition's metadata: - Partition metadata is lost (column stats, location pointer) - Underlying S3 data is preserved - Queries scoped to that partition will return no rows until re-registered
Highglue-delete-tableaws glue delete-table removes the table definition from the catalog.
Explanation
delete-table removes a Glue table definition: - Table schema and partition metadata are lost - Underlying S3 data is NOT deleted - Queries referencing this table will fail Preview the table first: aws glue get-table --database-name xxx --name yyy
Highiam-deleteaws iam delete-* removes IAM resources. Verify dependencies first.
Explanation
IAM delete commands remove identity resources: - delete-user: Removes IAM user (must detach policies first) - delete-role: Removes role (must detach policies first) - delete-policy: Removes managed policy - delete-group: Removes IAM group Check dependencies: aws iam list-attached-user-policies --user-name xxx aws iam list-entities-for-policy --policy-arn xxx Roles used by services (Lambda, EC2) will break!
Highlambda-deleteaws lambda delete-* permanently removes a Lambda resource (function, alias, layer version, event source mapping, etc.).
Explanation
delete-function removes a Lambda function completely: - Function code is deleted - All versions and aliases removed - Event source mappings deleted - Cannot be undone Backup function code first: aws lambda get-function --function-name xxx --query Code.Location List versions: aws lambda list-versions-by-function --function-name xxx
Highlogs-delete-log-groupaws logs delete-log-group permanently deletes a log group and all events.
Explanation
delete-log-group removes a CloudWatch log group: - All log streams are deleted - All log events are lost - Metric filters and subscriptions removed - Cannot be undone Export logs before deletion: aws logs create-export-task --log-group-name xxx \ --destination bucket --from 0 --to $(date +%s)000
Highlogs-delete-log-streamaws logs delete-log-stream permanently deletes a log stream and all events.
Explanation
delete-log-stream removes a specific log stream: - All events in the stream are deleted - Log group remains intact - Cannot be undone View log stream events before deletion: aws logs get-log-events --log-group-name xxx \ --log-stream-name yyy --limit 100
Highremoves AWS resourcesaws ec2 delete-* permanently removes AWS resources.
Explanation
EC2 delete commands permanently remove resources: - delete-snapshot: Removes EBS snapshot (backup data lost) - delete-volume: Destroys EBS volume and all data - delete-vpc: Removes VPC (must be empty) - delete-image: Deregisters AMI - delete-security-group: Removes firewall rules - delete-key-pair: Removes SSH key (can't SSH to instances using it) Always verify resource IDs: aws ec2 describe-<resource> --<resource>-ids xxx
Highs3api-delete-objectaws s3api delete-object[s]/delete-object-tagging — object(s) or tags are gone unless bucket versioning is enabled.
Explanation
delete-object / delete-objects / delete-object-tagging: - Without bucket versioning: objects or tags are permanently gone - With versioning (objects only): a delete marker is added; past versions recoverable - delete-objects is BATCH (up to 1000 keys per call) — a misfire can wipe thousands - No trash/recycle bin Check versioning first: aws s3api get-bucket-versioning --bucket xxx Preview the keys about to be deleted: aws s3api list-objects-v2 --bucket xxx --prefix yyy/
Mediumathena-delete-named-queryaws athena delete-named-query permanently removes a saved query.
Explanation
delete-named-query deletes a saved Athena query: - The stored query text and metadata are removed - No data is lost, but the query must be rewritten from scratch if it wasn't stored elsewhere Retrieve the query before deleting: aws athena get-named-query --named-query-id xxx
Mediumecr-delete-lifecycle-policyaws ecr delete-lifecycle-policy removes the repository lifecycle policy.
Explanation
delete-lifecycle-policy removes automatic image cleanup rules: - Old images will no longer be automatically deleted - May lead to storage cost increases - Repository will retain all images indefinitely View current policy: aws ecr get-lifecycle-policy --repository-name xxx
Mediumglue-delete-crawleraws glue delete-crawler removes the crawler configuration.
Explanation
delete-crawler removes a Glue crawler: - Crawler configuration (targets, schedule, schema detection rules) is lost - Schedules and classifiers tied to the crawler are orphaned - Can be re-created from Infrastructure-as-Code if present
Mediumglue-delete-dev-endpointaws glue delete-dev-endpoint tears down the development endpoint and any attached SageMaker notebook configuration.
Explanation
delete-dev-endpoint shuts down a Glue DevEndpoint: - Endpoint is stopped and deleted - Attached SageMaker notebook (if any) must be cleaned up separately - Ongoing sessions / jobs on the endpoint are terminated
Safe patterns
Checked first. A command that matches one is never blocked by this pack.
aws-describeaws-listaws-gets3-lss3-cpec2-terminate-dry-runec2-delete-dry-runsts-identitycfn-describeecr-loginathena-delete-with-where