CtrlK
BlogDocsLog inGet started
Tessl Logo

giuseppe-trisciuoglio/developer-kit

Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.

82

Quality

82%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Risky

Do not use without reviewing

Validation failed for skills in this tile
One or more skills have errors that need to be fixed before they can move to Implementation and Discovery review.
Overview
Quality
Evals
Security
Files

reference.mdplugins/developer-kit-aws/skills/aws-cloudformation/aws-cloudformation-s3/references/

AWS CloudFormation S3 - Reference

This reference guide contains detailed information about AWS CloudFormation resources, intrinsic functions, and configurations for S3 infrastructure.

AWS::S3::Bucket

Creates an Amazon S3 bucket.

Properties

PropertyTypeRequiredDescription
AccelerateConfigurationAccelerateConfigurationNoConfigures bucket acceleration
AccessControlStringNoA canned ACL (Private, PublicRead, etc.)
AnalyticsConfigurationsListNoAnalytics configurations for inventory reports
BucketEncryptionBucketEncryptionNoServer-side encryption configuration
BucketNameStringNoName of the bucket
CorsConfigurationCorsConfigurationNoCORS rules for cross-origin requests
EventBridgeConfigurationEventBridgeConfigurationNoEventBridge configuration
IntelligentTieringConfigurationIntelligentTieringConfigurationNoS3 Intelligent-Tiering configuration
InventoryConfigurationsListNoInventory configurations
LifecycleConfigurationLifecycleConfigurationNoLifecycle rules for object management
LoggingConfigurationLoggingConfigurationNoServer access logging configuration
MetricsConfigurationMetricsConfigurationNoCloudWatch metrics configuration
NotificationConfigurationNotificationConfigurationNoEvent notification configuration
ObjectLockConfigurationObjectLockConfigurationNoObject Lock configuration
ObjectLockEnabledBooleanNoWhether Object Lock is enabled
OwnershipControlsOwnershipControlsNoBucket ownership controls
PublicAccessBlockConfigurationPublicAccessBlockConfigurationNoBlock public access settings
ReplicationConfigurationReplicationConfigurationNoCross-region replication rules
TagsListNoTags assigned to the bucket
VersioningConfigurationVersioningConfigurationNoVersioning status
WebsiteConfigurationWebsiteConfigurationNoStatic website hosting configuration

VersioningConfiguration

VersioningConfiguration:
  Status: Enabled | Suspended
  MFADelete: Enabled | Disabled  # Optional

CorsConfiguration

CorsConfiguration:
  CorsRules:
    - AllowedHeaders:
        - "*"
      AllowedMethods:
        - GET
        - PUT
        - POST
        - DELETE
        - HEAD
      AllowedOrigins:
        - "https://example.com"
      ExposedHeaders:
        - ContentLength
        - Date
      MaxAge: 3600

LifecycleConfiguration

LifecycleConfiguration:
  Rules:
    - ID: string
      Status: Enabled | Disabled
      PrefixFilter:
        Prefix: logs/
      TagFilter:
        - Key: Environment
          Value: production
      ExpirationInDays: 30
      ExpirationDate: "2024-12-31T00:00:00.000Z"
      Transitions:
        - Days: 30
          StorageClass: STANDARD_IA | GLACIER | DEEP_ARCHIVE
        - Days: 90
          StorageClass: GLACIER
      NoncurrentVersionExpirationInDays: 7
      NoncurrentVersionTransitions:
        - NoncurrentDays: 30
          StorageClass: STANDARD_IA

LoggingConfiguration

LoggingConfiguration:
  DestinationBucketName: !Ref LogBucket
  LogFilePrefix: logs/
  LogFilePrefix: !Sub ${AWS::StackName}/logs/

BucketEncryption

BucketEncryption:
  ServerSideEncryptionConfiguration:
    - ServerSideEncryptionByDefault:
        SSEAlgorithm: AES256 | aws:kms | aws:kms:dsse
        KMSMasterKeyID: !Ref KMSKeyArn
    BucketKeyEnabled: true

PublicAccessBlockConfiguration

PublicAccessBlockConfiguration:
  BlockPublicAcls: true
  BlockPublicPolicy: true
  IgnorePublicAcls: true
  RestrictPublicBuckets: true

NotificationConfiguration

NotificationConfiguration:
  LambdaConfigurations:
    - Event: s3:ObjectCreated:*
      Function: !GetAtt ProcessingFunction.Arn
      Filter:
        S3Key:
          Rules:
            - Name: prefix
              Value: uploads/
    - Event: s3:ObjectRemoved:*
      Function: !GetAtt CleanupFunction.Arn
  QueueConfigurations:
    - Event: s3:ObjectCreated:*
      Queue: !Ref EventQueue
      Filter:
        S3Key:
          Rules:
            - Name: suffix
              Value: .log
  TopicConfigurations:
    - Event: s3:ObjectCreated:*
      Topic: !Ref EventTopic

ReplicationConfiguration

ReplicationConfiguration:
  Role: !GetAtt ReplicationRole.Arn
  Rules:
    - ID: string
      Status: Enabled | Disabled
      Priority: 1
      Filter:
        Prefix: ""
        And:
          Prefix: ""
          Tags:
            - Key: Key
              Value: Value
      Destination:
        Bucket: arn:aws:s3:::destination-bucket
        Account: destination-account-id
        StorageClass: STANDARD | STANDARD_IA | INTELLIGENT_TIERING
        EncryptionConfiguration:
          ReplicaKmsKeyID: kms-key-arn
        AccessControlTranslation:
          Owner: Destination
        Account: account-id
        Metrics:
          Status: Enabled
          EventThreshold:
            Minutes: 15
        ReplicationTime:
          Status: Enabled
          Time:
            Minutes: 15
      SourceSelectionCriteria:
        SseKmsEncryptedObjects:
          Status: Enabled

WebsiteConfiguration

WebsiteConfiguration:
  IndexDocument: index.html
  ErrorDocument: error.html
  RoutingRules:
    - Condition:
        KeyPrefixEquals: docs/
      Redirect:
        ReplaceKeyWith: documents/index.html
    - Condition:
        HttpErrorCodeReturnedEquals: 404
      Redirect:
        Protocol: https
        HostName: example.com
        ReplaceKeyWith: 404.html

Attributes

AttributeDescription
ArnThe Amazon Resource Name (ARN) of the bucket
DomainNameThe DNS name of the bucket
DualStackDomainNameThe DNS name of the bucket when using IPv6
RegionalDomainNameThe regional domain name of the bucket
WebsiteURLURL of the website endpoint
S3CanonicalUserIdThe canonical user ID for the bucket owner

Examples

Basic Bucket

Resources:
  DataBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: my-data-bucket

Bucket with Versioning and Logging

Resources:
  DataBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: my-data-bucket
      VersioningConfiguration:
        Status: Enabled
      LoggingConfiguration:
        DestinationBucketName: !Ref LogBucket
        LogFilePrefix: logs/
      Tags:
        - Key: Environment
          Value: production

Bucket with Lifecycle Rules

Resources:
  LifecycleBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: my-lifecycle-bucket
      LifecycleConfiguration:
        Rules:
          - Id: ArchiveOldData
            Status: Enabled
            PrefixFilter:
              Prefix: archive/
            Transitions:
              - Days: 30
                StorageClass: GLACIER
            ExpirationInDays: 365

Bucket with CORS

Resources:
  CorsBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: my-cors-bucket
      CorsConfiguration:
        CorsRules:
          - AllowedHeaders:
              - Authorization
              - Content-Type
            AllowedMethods:
              - GET
              - PUT
              - POST
            AllowedOrigins:
              - "https://example.com"
              - "https://*.example.com"
            MaxAge: 3600

AWS::S3::BucketPolicy

Applies a bucket policy to an Amazon S3 bucket.

Properties

PropertyTypeRequiredDescription
BucketStringYesName of the bucket to apply the policy to
PolicyDocumentPolicyDocumentYesPolicy to apply

PolicyDocument Structure

PolicyDocument:
  Version: "2012-10-17" | "2008-10-17"
  Id: policy-id
  Statement:
    - Sid: statement-id
      Effect: Allow | Deny
      Principal:
        AWS: arn:aws:iam::account-id:user/user-name
        Service: service-name.amazonaws.com
        CanonicalUser: canonical-user-id
        "*":  # All principals
      Action:
        - s3:GetObject
        - s3:PutObject
        - s3:DeleteObject
      NotAction:
        - s3:*
      Resource:
        - arn:aws:s3:::bucket-name
        - arn:aws:s3:::bucket-name/*
      NotResource:
        - arn:aws:s3:::bucket-name/secret/*
      Condition:
        ConditionOperator:
          ConditionKey: condition-value

Condition Operators

OperatorDescription
StringEqualsExact string match
StringNotEqualsNegated string match
StringLikeString with wildcards
StringNotLikeNegated string with wildcards
NumericEqualsExact number match
NumericNotEqualsNegated number match
NumericLessThanLess than comparison
NumericLessThanEqualsLess than or equal
NumericGreaterThanGreater than comparison
NumericGreaterThanEqualsGreater than or equal
BoolBoolean comparison
IpAddressIP address range
NotIpAddressExcluded IP address
ArnEqualsARN match
ArnLikeARN with wildcards

Common Condition Keys

KeyDescription
aws:sourceVpceVPC endpoint ID
aws:sourceVpcVPC ID
aws:PrincipalAccountPrincipal's account ID
aws:PrincipalArnPrincipal's ARN
aws:SecureTransportWhether request uses HTTPS
s3:prefixObject key prefix
s3:DelimiterDelimiter for listing
s3:max-keysMax keys in listing

Examples

Allow Access from VPC Endpoint

Resources:
  PrivateBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: my-private-bucket

  BucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      Bucket: !Ref PrivateBucket
      PolicyDocument:
        Statement:
          - Sid: AllowVPCEndpoint
            Effect: Allow
            Principal: "*"
            Action: s3:GetObject
            Resource: !Sub ${PrivateBucket.Arn}/*
            Condition:
              StringEquals:
                aws:sourceVpce: !Ref VPCEndpointId

Deny Unencrypted Uploads

Resources:
  SecureBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: my-secure-bucket

  BucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      Bucket: !Ref SecureBucket
      PolicyDocument:
        Statement:
          - Sid: DenyUnencryptedUploads
            Effect: Deny
            Principal: "*"
            Action: s3:PutObject
            Resource: !Sub ${SecureBucket.Arn}/*
            Condition:
              StringNotEquals:
                s3:x-amz-server-side-encryption: AES256
          - Sid: DenyKMSUnencryptedUploads
            Effect: Deny
            Principal: "*"
            Action: s3:PutObject
            Resource: !Sub ${SecureBucket.Arn}/*
            Condition:
              StringNotEquals:
                s3:x-amz-server-side-encryption: aws:kms
              Null:
                s3:x-amz-server-side-encryption-aws-kms-key-id: false

Allow CloudFront OAI Access

Resources:
  WebsiteBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: my-website-bucket
      WebsiteConfiguration:
        IndexDocument: index.html
        ErrorDocument: error.html

  BucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      Bucket: !Ref WebsiteBucket
      PolicyDocument:
        Statement:
          - Sid: CloudFrontReadAccess
            Effect: Allow
            Principal:
              CanonicalUser: !GetAtt CloudFrontOAI.S3CanonicalUserId
            Action: s3:GetObject
            Resource: !Sub ${WebsiteBucket.Arn}/*

  CloudFrontOAI:
    Type: AWS::CloudFront::CloudFrontOriginAccessIdentity
    Properties:
      CloudFrontOriginAccessIdentityConfig:
        Comment: Website OAI

Cross-Account Access

Resources:
  SharedBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: my-shared-bucket

  BucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      Bucket: !Ref SharedBucket
      PolicyDocument:
        Statement:
          - Sid: CrossAccountRead
            Effect: Allow
            Principal:
              AWS:
                - arn:aws:iam::123456789012:role/ReadRole
                - arn:aws:iam::123456789012:user/ReadUser
            Action:
              - s3:GetObject
              - s3:GetObjectVersion
            Resource: !Sub ${SharedBucket.Arn}/*
          - Sid: CrossAccountWrite
            Effect: Allow
            Principal:
              AWS: arn:aws:iam::123456789012:role/WriteRole
            Action:
              - s3:PutObject
            Resource: !Sub ${SharedBucket.Arn}/*

Intrinsic Functions

Fn::Ref

Returns the bucket name.

BucketName: !Ref DataBucket

Fn::GetAtt

Returns bucket attributes.

BucketArn: !GetAtt DataBucket.Arn
BucketDomainName: !GetAtt DataBucket.DomainName
WebsiteURL: !GetAtt DataBucket.WebsiteURL
S3CanonicalUserId: !GetAtt DataBucket.S3CanonicalUserId

Fn::Sub

Substitutes variables in an input string with values.

BucketArn: !Sub "arn:aws:s3:::${BucketName}"

Fn::Join

Appends a set of values into a single value.

Resource: !Join
  - ""
  - - "arn:aws:s3:::"
    - !Ref BucketName
    - "/*"

Fn::ImportValue

Imports an output value exported by another stack.

BucketArn: !ImportValue storage-stack-BucketArn

Best Practices

Security

  1. Block Public Access: Always enable block public access settings
  2. Use Bucket Policies: Define explicit access controls
  3. Enable Versioning: Protect against accidental deletion
  4. Use Encryption: Enable server-side encryption
  5. Use VPC Endpoints: Keep traffic within AWS network

Cost Optimization

  1. Lifecycle Rules: Move data to cheaper storage classes
  2. Intelligent-Tiering: Use for unpredictable access patterns
  3. Delete Old Versions: Clean up noncurrent versions
  4. Monitor with Metrics: Track storage usage

Performance

  1. Use Prefixes: Distribute objects across prefixes for parallelism
  2. Enable Transfer Acceleration: For faster global uploads
  3. Use Multi-Region Access Points: For low-latency access

plugins

developer-kit-aws

skills

aws-cloudformation

aws-cloudformation-s3

README.md

tile.json