Next, let's wire up the trigger function and define the worker function. As noted earlier, this entire process will begin upon uploading an image to S3. The Serverless Framework makes this type of wiring straightforward with the events section in serverless.yml:
functions: UploadImage: handler: handler.uploadImage events: - s3: bucket: brianz-image-resize-fanout event: s3:ObjectCreated:* ResizeImage: handler: handler.resizeImage
What this says is that the uploadImage function will be called whenever an object is created in the named S3 bucket. That's all there is to it. Again, this event could have been anything else supported in AWS, provided the trigger gives access to some image which needs resizing. ...