Skip to content

Instantly share code, notes, and snippets.

@rambabusaravanan
Last active January 29, 2019 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rambabusaravanan/1d8acc3d0dfff6ea08c5daae45ea286c to your computer and use it in GitHub Desktop.
Save rambabusaravanan/1d8acc3d0dfff6ea08c5daae45ea286c to your computer and use it in GitHub Desktop.
Serverless Framework CloudFormation Templates
resources:
Resources:
TestOneBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:service}-${self:provider.region}-test-one
CorsConfiguration:
CorsRules:
- AllowedOrigins: ['*']
AllowedHeaders: ['*']
AllowedMethods: [GET]
MaxAge: 6000
LifecycleConfiguration:
Rules:
- Id: TmpTTLRule
AbortIncompleteMultipartUpload:
DaysAfterInitiation: 1
ExpirationInDays: 1
Prefix: /tmp
Status: Enabled
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: index.html
TestOneBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: "TestOneBucket"
PolicyDocument:
Statement:
-
Action: ["s3:GetObject"]
Effect: "Allow"
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "TestOneBucket" } , "/*" ]]}
Resource:
Fn::Join:
- ""
-
- "arn:aws:s3:::"
-
Ref: "TestOneBucket"
- "/*"
Principal: "*"
# Condition:
# StringLike:
# aws:Referer:
# - "http://www.example.com/*"
# - "http://example.com/*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment