giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-aws/skills/aws-cloudformation/aws-cloudformation-s3
aws-cloudformation-s3
VerifiedProvides AWS CloudFormation patterns for Amazon S3. Use when creating S3 buckets, policies, versioning, lifecycle rules, and implementing template structure with Parameters, Outputs, Mappings, Conditions, and cross-stack references.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.1 KB |
| references/advanced-configuration.md | markdown | 5.8 KB |
| references/complete-examples.md | markdown | 6.0 KB |
| references/examples.md | markdown | 22.3 KB |
| references/reference.md | markdown | 14.1 KB |
references/complete-examples.md
View on GitHub# S3 CloudFormation - Complete Examples
## Basic S3 Bucket
```yaml
AWSTemplateFormatVersion: 2010-09-09
Description: Simple S3 bucket with default settings
Resources:
DataBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: my-data-bucket
Tags:
- Key: Environment
Value: production
- Key: Project
Value: my-project
```
## Bucket with Versioning and Encryption
```yaml
DataBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "${AWS::StackName}-data"
VersioningConfiguration:
Status: Enabled
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
```
## Bucket with Lifecycle Rules
```yaml
DataBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "${AWS::StackName}-data"
LifecycleConfiguration:
Rules:
- Id: ArchiveOldData
Status: Enabled
Transitions:
- StorageClass: INTELLIGENT_TIERING
TransitionInDays: 90
- StorageClass: GLACIER
TransitionInDays: 365
ExpirationInDays: 2555
```
## Bucket with CORS Configuration
```yaml
DataBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "${AWS::StackName}-data"
CorsConfiguration:
CorsRules:
- AllowedHeaders:
- '*'
AllowedMethods:
- GET
- PUT
- POST
- DELETE
AllowedOrigins:
- https://example.com
ExposedHeaders:
- ETag
```
## Bucket Policy for IAM Role Access
```yaml
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref DataBucket
PolicyDocument:
Statement:
- Effect: Allow
Principal:
AWS: !Ref RoleArn
Action:
- s3:GetObject
- s3:PutObject
- s3:DeleteObject
Resource: !Sub "${DataBucket.Arn}/*"
```
## Complete Production S3 Stack
```yaml
AWSTemplateFormatVersion: 2010-09-09
Description: Production S3 bucket with all features
Parameters:
BucketName:
Type: String
Description: Name of the S3 bucket
Environment:
Type: String
AllowedValues: [dev, staging, prod]
EnableVersioning:
Type: String
Default: 'true'
AllowedValues: ['true', 'false']
Resources:
DataBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref BucketName
VersioningConfiguration:
Status: !Ref EnableVersioning
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
LifecycleConfiguration:
Rules:
- Id: DeleteOldVersions
Status: Enabled
NoncurrentVersionExpirationInDays: 90
- Id: ArchiveToGlacier
Status: Enabled
Transitions:
- StorageClass: INTELLIGENT_TIERING
TransitionInDays: 90
- StorageClass: GLACIER
TransitionInDays: 365
Tags:
- Key: Environment
Value: !Ref Environment
- Key: ManagedBy
Value: CloudFormation
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref DataBucket
PolicyDocument:
Statement:
- Effect: Allow
Principal:
AWS: !Ref DataAccessRole
Action:
- s3:GetObject
- s3:PutObject
- s3:DeleteObject
Resource: !Sub "${DataBucket.Arn}/*"
Outputs:
BucketName:
Description: Name of the S3 bucket
Value: !Ref DataBucket
Export:
Name: !Sub '${AWS::StackName}-BucketName'
BucketArn:
Description: ARN of the S3 bucket
Value: !GetAtt DataBucket.Arn
Export:
Name: !Sub '${AWS::StackName}-BucketArn'
```
## S3 Event Notifications
```yaml
DataBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "${AWS::StackName}-data"
NotificationConfiguration:
LambdaConfigurations:
- Event: s3:ObjectCreated:*
Function: !GetAtt LambdaFunction.Arn
- Event: s3:ObjectRemoved:*
Function: !GetAtt LambdaFunction.Arn
QueueConfigurations:
- Event: s3:ObjectCreated:*
Queue: !GetAtt Queue.Arn
TopicConfigurations:
- Event: s3:ObjectCreated:*
Topic: !Ref SNSTopic
```
## Static Website Hosting
```yaml
WebsiteBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "${AWS::StackName}-website"
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: error.html
PublicAccessBlockConfiguration:
BlockPublicAcls: false
BlockPublicPolicy: false
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref WebsiteBucket
PolicyDocument:
Statement:
- Effect: Allow
Principal: '*'
Action: s3:GetObject
Resource: !Sub '${WebsiteBucket.Arn}/*'
Outputs:
WebsiteURL:
Description: S3 Website URL
Value: !GetAtt WebsiteBucket.WebsiteURL
```
## Cross-Region Replication
```yaml
SourceBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: source-bucket
VersioningConfiguration:
Status: Enabled
ReplicationBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub 'destination-bucket-${AWS::Region}'
VersioningConfiguration:
Status: Enabled
ReplicationConfiguration:
Type: AWS::S3::BucketReplication
Properties:
Role: !GetAtt ReplicationRole.Arn
Bucket: !Ref SourceBucket
ReplicationConfiguration:
Rules:
- Destination:
Bucket: !Ref ReplicationBucket
Account: !Ref DestinationAccountId
Status: Enabled
Prefix: data/
```
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 |