Configure S3 buckets with security, lifecycle, and replication policies
Creates secure S3 buckets with encryption, public access blocking, versioning, and lifecycle policies. Use when users need to provision new S3 buckets with enterprise-grade security and cost optimization settings.
/plugin marketplace add pluginagentmarketplace/custom-plugin-aws/plugin install pluginagentmarketplace-aws-cloud-assistant@pluginagentmarketplace/custom-plugin-awsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/s3-lifecycle.jsonassets/schema.jsonreferences/GUIDE.mdreferences/PATTERNS.mdscripts/validate.pyManage S3 buckets with enterprise security and cost optimization.
| Attribute | Value |
|---|---|
| AWS Service | S3 |
| Complexity | Low-Medium |
| Est. Time | 5-15 min |
| Prerequisites | AWS account |
| Parameter | Type | Description | Validation |
|---|---|---|---|
| bucket_name | string | Globally unique name | ^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$ |
| region | string | AWS region | Valid region code |
| Parameter | Type | Default | Description |
|---|---|---|---|
| versioning | bool | false | Enable versioning |
| encryption | string | AES256 | SSE-S3, SSE-KMS, or none |
| public_access_block | bool | true | Block public access |
| lifecycle_rules | array | [] | Lifecycle configurations |
| cors_rules | array | [] | CORS configuration |
1. Validate bucket name availability
2. Create bucket with region
3. Configure Block Public Access
4. Enable encryption
5. Set versioning (if enabled)
6. Apply lifecycle rules
7. Configure logging
# Create bucket
aws s3api create-bucket \
--bucket my-secure-bucket \
--region us-east-1
# Block public access
aws s3api put-public-access-block \
--bucket my-secure-bucket \
--public-access-block-configuration \
"BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"
# Enable encryption
aws s3api put-bucket-encryption \
--bucket my-secure-bucket \
--server-side-encryption-configuration '{
"Rules": [{
"ApplyServerSideEncryptionByDefault": {
"SSEAlgorithm": "AES256"
}
}]
}'
# Enable versioning
aws s3api put-bucket-versioning \
--bucket my-secure-bucket \
--versioning-configuration Status=Enabled
{
"Rules": [
{
"ID": "MoveToGlacier",
"Status": "Enabled",
"Filter": {"Prefix": "logs/"},
"Transitions": [
{"Days": 30, "StorageClass": "STANDARD_IA"},
{"Days": 90, "StorageClass": "GLACIER"}
],
"Expiration": {"Days": 365}
}
]
}
def s3_operation_with_retry(operation, max_retries=3):
for attempt in range(max_retries):
try:
return operation()
except s3.exceptions.SlowDown:
wait = 2 ** attempt
time.sleep(wait)
except s3.exceptions.ServiceUnavailable:
time.sleep(2 ** attempt)
raise Exception("Max retries exceeded")
BucketSizeBytes - Total bucket sizeNumberOfObjects - Object countAllRequests - Request count4xxErrors / 5xxErrors - Error ratesbucket_owner bucket [time] remote_ip requester request_id operation key
| Symptom | Cause | Solution |
|---|---|---|
| BucketAlreadyExists | Name taken globally | Choose unique name |
| AccessDenied | IAM or bucket policy | Check both policies |
| SlowDown | Request rate exceeded | Add random prefix to keys |
| NoSuchBucket | Bucket deleted | Verify bucket exists |
Check order:
1. IAM user/role policy (s3:GetObject, etc.)
2. Bucket policy (Principal, Resource)
3. Block Public Access settings
4. Object ACL (if ACLs enabled)
5. VPC Endpoint policy (if using)
| Storage Class | Cost | Retrieval | Use Case |
|---|---|---|---|
| Standard | $$$ | Instant | Frequent access |
| Intelligent-Tiering | $$ | Instant | Unknown pattern |
| Standard-IA | $ | Instant | Infrequent |
| Glacier Instant | ¢ | Milliseconds | Archive, quick access |
| Glacier Flexible | ¢ | Minutes-hours | Archive |
| Glacier Deep Archive | ¢ | Hours | Long-term |
def test_s3_bucket_creation():
# Arrange
bucket_name = f"test-bucket-{uuid.uuid4().hex[:8]}"
# Act
s3.create_bucket(Bucket=bucket_name)
s3.put_public_access_block(
Bucket=bucket_name,
PublicAccessBlockConfiguration={
'BlockPublicAcls': True,
'IgnorePublicAcls': True,
'BlockPublicPolicy': True,
'RestrictPublicBuckets': True
}
)
# Assert
response = s3.get_public_access_block(Bucket=bucket_name)
assert response['PublicAccessBlockConfiguration']['BlockPublicAcls']
# Cleanup
s3.delete_bucket(Bucket=bucket_name)
assets/s3-lifecycle.json - Lifecycle configuration templateThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.