npx skills add ...
npx skills add aws/agent-toolkit-for-aws --skill securing-s3-buckets
npx skills add aws/agent-toolkit-for-aws --skill securing-s3-buckets
Create and secure S3 buckets following AWS best practices for access control, encryption, monitoring, and remediation of misconfigurations. Use when the user wants to secure a new bucket, audit an existing bucket, fix a security finding, configure encryption, or enable logging and monitoring. Do NOT use for general S3 data operations, S3 Tables setup, or discovering existing data assets.
Implements layered S3 security controls across five workflows: securing new buckets, auditing existing configurations, remediating findings, configuring encryption, and enabling monitoring. Follows AWS Well-Architected security best practices.
Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging, observability). Fall back to AWS CLI or shell otherwise.
Check for required tools before starting.
Constraints:
aws sts get-caller-identitySee references/iam-permissions.md for IAM permissions by workflow.
| User intent | Workflow |
|---|---|
| Secure a new bucket | A: Secure New Bucket |
| Audit / review existing bucket | B: Audit Existing Bucket |
| Fix a specific finding | C: Remediate Issue |
| Configure encryption | D: Configure Encryption |
| Enable logging / monitoring | E: Enable Monitoring |
Constraints:
aws iam simulate-principal-policy to validate permissions before write operationsThese rules apply to ALL workflows that call put-bucket-policy:
aws s3api get-bucket-policy) — put-bucket-policy replaces the entire policyaws s3api get-bucket-policy --bucket <name> --output text > backup-policy-$(date +%s).jsonNoSuchBucketPolicy is returned, proceed with a new policy — no backup is neededecho '<policy>' | python3 -m json.tool)put-bucket-policy command and wait for confirmationSee references/workflows.md for full CLI steps.
Required steps (execute in order, do not skip):
--bucket-namespace account-regionalDenyInsecureTransport bucket policyConstraints:
You MUST pass --bucket-namespace account-regional on create-bucket call — this is REQUIRED, not optional. Example:
You MUST NOT change Block Public Access — S3 enables it by default on new buckets
You MUST NOT change ACL ownership controls — S3 disables ACLs (BucketOwnerEnforced) by default
You MUST apply a bucket policy with a DenyInsecureTransport statement that denies s3:* when aws:SecureTransport is false — this is REQUIRED, not optional. Example:
You MUST ask the user which logging option they want before step 4
You MUST follow the put-bucket-policy safety rules for steps 4 and 5
You SHOULD confirm each step succeeded before proceeding
See references/audit-checklist.md for the full checklist.
Constraints:
See references/remediation.md for fix commands by issue type.
Constraints:
See references/encryption.md for encryption options and commands.
Constraints:
aws/s3 keyBucketKeyEnabled: true and BlockedEncryptionTypes: [SSE-C] in all configurationsaws/s3 and aliases without error — agent-enforced constraints. Verify with get-bucket-encryption after applying.See references/workflows.md for full CLI steps.
Constraints:
ObjectLockConfigurationNotFoundError — Object Lock is not enabled. Treat as NOT CONFIGURED, not a failure.
AccessDenied on audit commands — Check IAM policy, bucket policy, Block Public Access, VPC endpoint policy, and SCPs/RCPs. Use aws iam simulate-principal-policy to diagnose.
put-bucket-policy silently removes existing statements — See put-bucket-policy safety rules.
GuardDuty BadRequestException: detector already exists — Run aws guardduty list-detectors first; only call create-detector if empty.
CloudTrail changes not taking effect — Verify you are using --region <trail-home-region>, not the bucket's region. Find it with aws cloudtrail describe-trails --query 'trailList[*].[Name,HomeRegion]'.