itsmostafa/aws-agent-skills / skills/s3
s3
VerifiedAWS S3 object storage for bucket management, object operations, and access control. Use when creating buckets, uploading files, configuring lifecycle policies, setting up static websites, managing permissions, or implementing cross-region replication.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.1 KB |
| security.md | markdown | 7.4 KB |
security.md
View on GitHub# S3 Security Configuration
Comprehensive security configurations for S3 buckets.
## Access Control Hierarchy
S3 access is evaluated in this order:
1. **Account-level public access block** (strongest)
2. **Bucket-level public access block**
3. **Bucket policy**
4. **IAM policies**
5. **ACLs** (legacy, avoid using)
## Block Public Access
### Account-Level Block
```bash
aws s3control put-public-access-block \
--account-id 123456789012 \
--public-access-block-configuration \
BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
```
### Bucket-Level Block
```bash
aws s3api put-public-access-block \
--bucket my-bucket \
--public-access-block-configuration '{
"BlockPublicAcls": true,
"IgnorePublicAcls": true,
"BlockPublicPolicy": true,
"RestrictPublicBuckets": true
}'
```
### Setting Explanations
| Setting | Effect |
|---------|--------|
| `BlockPublicAcls` | Rejects PUT requests with public ACLs |
| `IgnorePublicAcls` | Ignores existing public ACLs |
| `BlockPublicPolicy` | Rejects bucket policies that grant public access |
| `RestrictPublicBuckets` | Restricts access to AWS principals only |
## Bucket Policies
### Deny Unencrypted Uploads
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyUnencryptedUploads",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::my-bucket/*",
"Condition": {
"Null": {
"s3:x-amz-server-side-encryption": "true"
}
}
}
]
}
```
### Enforce HTTPS Only
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyHTTP",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}
]
}
```
### Restrict to VPC Endpoint
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "RestrictToVPCEndpoint",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"StringNotEquals": {
"aws:SourceVpce": "vpce-1234567890abcdef0"
}
}
}
]
}
```
### Cross-Account Access
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CrossAccountAccess",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111111111111:role/CrossAccountRole"
},
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
]
}
]
}
```
### Restrict to Specific IP Ranges
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "RestrictToOfficeIPs",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"NotIpAddress": {
"aws:SourceIp": ["192.0.2.0/24", "203.0.113.0/24"]
},
"Null": {
"aws:SourceVpc": "true"
}
}
}
]
}
```
## Encryption
### Server-Side Encryption (SSE-S3)
```bash
# Set default encryption
aws s3api put-bucket-encryption \
--bucket my-bucket \
--server-side-encryption-configuration '{
"Rules": [{
"ApplyServerSideEncryptionByDefault": {
"SSEAlgorithm": "AES256"
},
"BucketKeyEnabled": true
}]
}'
```
### SSE-KMS (Customer Managed Key)
```bash
aws s3api put-bucket-encryption \
--bucket my-bucket \
--server-side-encryption-configuration '{
"Rules": [{
"ApplyServerSideEncryptionByDefault": {
"SSEAlgorithm": "aws:kms",
"KMSMasterKeyID": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
},
"BucketKeyEnabled": true
}]
}'
```
### Bucket Key
Enable Bucket Key to reduce KMS API calls and costs:
```bash
aws s3api put-bucket-encryption \
--bucket my-bucket \
--server-side-encryption-configuration '{
"Rules": [{
"ApplyServerSideEncryptionByDefault": {
"SSEAlgorithm": "aws:kms",
"KMSMasterKeyID": "alias/my-key"
},
"BucketKeyEnabled": true
}]
}'
```
## Versioning and MFA Delete
### Enable Versioning
```bash
aws s3api put-bucket-versioning \
--bucket my-bucket \
--versioning-configuration Status=Enabled
```
### Enable MFA Delete
Requires using root credentials:
```bash
aws s3api put-bucket-versioning \
--bucket my-bucket \
--versioning-configuration Status=Enabled,MFADelete=Enabled \
--mfa "arn:aws:iam::123456789012:mfa/root-account-mfa-device 123456"
```
## Access Logging
```bash
# Create logging bucket
aws s3api create-bucket --bucket my-bucket-logs --region us-east-1
# Set ACL for S3 log delivery
aws s3api put-bucket-acl \
--bucket my-bucket-logs \
--grant-write URI=http://acs.amazonaws.com/groups/s3/LogDelivery \
--grant-read-acp URI=http://acs.amazonaws.com/groups/s3/LogDelivery
# Enable logging on source bucket
aws s3api put-bucket-logging \
--bucket my-bucket \
--bucket-logging-status '{
"LoggingEnabled": {
"TargetBucket": "my-bucket-logs",
"TargetPrefix": "access-logs/"
}
}'
```
## Object Lock (WORM)
### Enable Object Lock on New Bucket
```bash
aws s3api create-bucket \
--bucket my-worm-bucket \
--object-lock-enabled-for-bucket \
--region us-east-1
```
### Set Default Retention
```bash
aws s3api put-object-lock-configuration \
--bucket my-worm-bucket \
--object-lock-configuration '{
"ObjectLockEnabled": "Enabled",
"Rule": {
"DefaultRetention": {
"Mode": "GOVERNANCE",
"Days": 365
}
}
}'
```
### Retention Modes
| Mode | Description |
|------|-------------|
| **Governance** | Users with special permissions can delete |
| **Compliance** | No one can delete until retention expires |
## VPC Endpoint Access
### Create Gateway Endpoint
```bash
aws ec2 create-vpc-endpoint \
--vpc-id vpc-12345678 \
--service-name com.amazonaws.us-east-1.s3 \
--route-table-ids rtb-12345678
```
### Endpoint Policy
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": ["s3:GetObject", "s3:PutObject"],
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
```
## Security Monitoring
### S3 Access Analyzer
```bash
# Check for public or shared buckets
aws accessanalyzer list-analyzed-resources \
--analyzer-arn arn:aws:access-analyzer:us-east-1:123456789012:analyzer/MyAnalyzer \
--resource-type AWS::S3::Bucket
```
### CloudTrail Data Events
```bash
aws cloudtrail put-event-selectors \
--trail-name MyTrail \
--event-selectors '[{
"ReadWriteType": "All",
"IncludeManagementEvents": true,
"DataResources": [{
"Type": "AWS::S3::Object",
"Values": ["arn:aws:s3:::my-bucket/"]
}]
}]'
```
## Security Checklist
- [ ] Public access blocked at account level
- [ ] Public access blocked at bucket level
- [ ] Bucket policy enforces HTTPS
- [ ] Server-side encryption enabled
- [ ] Versioning enabled
- [ ] MFA Delete enabled (critical buckets)
- [ ] Access logging enabled
- [ ] CloudTrail data events enabled
- [ ] VPC endpoint for private access
- [ ] Object Lock for compliance (if needed)
- [ ] Regular access reviews with Access Analyzer
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |