EDIT: Managed to solve this… it was quite simple eventually, but I have to tell that for some reason I just did not find this…
So, I added “resourses” section to the end of serverless.yml. Down there is a new version. I write to this bucket just adding suffix “-out” to the bucket name when writing files out. Hope this helps someone else also.
original message
Hi there!
I’m a real n00b in this serverless stuff.
I am trying to learn how to create simple serverless service, (by modifying the aws-ffmpeg-layer example).
I have succeeded to run conversions with my own setup, but only so that the input and output bucket are the same.
How should I modify my serverless yml, so that it would create separate outputbucket?
And how to access that bucket from the handler?
Here is my serverless.yml right now. This creates only one bucket (for input)
Original message ends here
org: myorg
service: myapp
frameworkVersion: ">=1.34.0 <2.18.0"
provider:
name: aws
lambdaHashingVersion: 20201221
runtime: nodejs12.x
iamRoleStatements:
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
- s3:DeleteObject
- s3:ListObjects
Resource:
- "arn:aws:s3:::${self:custom.bucketin}/*"
- "arn:aws:s3:::${self:custom.bucketout}/*"
functions:
mkgif:
handler: handler.mkgif
events:
- s3: ${self:custom.bucketin}
layers:
- {Ref: FfmpegLambdaLayer}
layers:
ffmpeg:
path: layer
custom:
bucketin: ${env:BUCKET, 'gifmakerinputbucket'}
bucketout: ${env:BUCKET, 'gifmakeroutpubucket'}
resources:
Resources:
S3OutputBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.bucketout}