Skip to content

Instantly share code, notes, and snippets.

@sreesarma
Created November 22, 2018 20:11
Show Gist options
  • Save sreesarma/a3fcd5a7d47d51438814314efd7c003d to your computer and use it in GitHub Desktop.
Save sreesarma/a3fcd5a7d47d51438814314efd7c003d to your computer and use it in GitHub Desktop.
# Save Directly to S3 -- serverless.yml
service: css-s3-test # NOTE: update this with your service name
plugins:
- serverless-offline
custom:
bucket: your-s3-bucket-name-here
provider:
name: aws
runtime: nodejs8.10
iamRoleStatements:
- Effect: 'Allow'
Action: 'S3:*'
Resource: "arn:aws:s3:::${self:custom.bucket}/*"
functions:
save:
description: "Upload JSON Directly to S3"
handler: handler.save
environment:
bucket: ${self:custom.bucket}
events:
- http:
path: save
method: post
cors: true
request:
parameters:
body:
data: true
resources:
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: your-s3-bucket-name-here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment