Skip to content

Commit

Permalink
makes s3 bucket publicly accessible, #13
Browse files Browse the repository at this point in the history
  • Loading branch information
Danwhy committed Aug 1, 2018
1 parent 629e1b6 commit 87f622e
Showing 1 changed file with 43 additions and 6 deletions.
49 changes: 43 additions & 6 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ functions:
processFile:
handler: lambda/processFile/index.handler
timeout: 90
events:
- s3:
bucket: ${opt:bucket, 'smgco-360'}
event: s3:ObjectCreated:*
rules:
- suffix: .ggpkg

toggleStatus:
handler: lambda/toggleStatus/index.handler
Expand Down Expand Up @@ -97,6 +91,49 @@ resources:
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
S3Bucket360:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: ${opt:bucket, 'smgco-360'}
CorsConfiguration:
CorsRules:
- AllowedHeaders:
- "*"
AllowedMethods:
- GET
AllowedOrigins:
- "*"
NotificationConfiguration:
LambdaConfigurations:
- Event: "s3:ObjectCreated:*"
Function:
"Fn::GetAtt": [ ProcessFileLambdaFunction, Arn ]
ProcessFileLambdaPermissionS3Bucket360:
DependsOn:
- ProcessFileLambdaFunction
Type: AWS::Lambda::Permission
Properties:
FunctionName:
"Fn::GetAtt": [ ProcessFileLambdaFunction, Arn ]
Action: "lambda:InvokeFunction"
Principal: "s3.amazonaws.com"
SourceArn: "arn:aws:s3:::${opt:bucket, 'smgco-360'}"
360BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: S3Bucket360
PolicyDocument:
Statement:
Action: "s3:GetObject"
Effect: "Allow"
Resource:
Fn::Join:
- ""
- - "arn:aws:s3:::"
- Ref: S3Bucket360
- "/*"
Principal: "*"

plugins:
- serverless-offline

0 comments on commit 87f622e

Please sign in to comment.