AWS S3 Cloudformation: S3 CORS example

An example Cloudformation that makes a bucket with CORS enabled (unlike the AWS docs, this shows how to do it with Cloudformation rather than XML).

AWSTemplateFormatVersion: "2010-09-09"

Description: CORS example

Resources:
  S3Bucket:
    Type: "AWS::S3::Bucket"
    Properties:
      CorsConfiguration:
        CorsRules:
          -
            AllowedOrigins: 
              - "*"
            AllowedMethods: 
              - POST
              - GET
              - PUT
              - DELETE
              - HEAD
            AllowedHeaders: 
              - "*"

Outputs:
  BucketName:
    Description: Video storage bucket
    Value: !GetAtt S3Bucket.Arn

Leave a Reply

Your email address will not be published. Required fields are marked *