serverless-s3-event

0.2.1 • Public • Published

serverless-s3-event

The serverless framework makes it easy to push NotificationConfiguration into an existing S3 bucket.

Installation

$ npm i serverless-s3-event

add the plugin to serverless.yml

# serverless.yml 
plugins:
  - serverless-s3-event

Configuration

custom:
  BucketConfigurations:
    BucketName: ${env:BUCKET_NAME}
      NotificationConfiguration:
        LambdaFunctionConfigurations:
          Id: ${env:EVENT_NAME}
            LambdaFunctionArn: ${env:LAMBDA_ARN}
            Events:
              - s3:ObjectCreated:Put
            Filter:
              Key:
                FilterRules:
                  Name: Suffix
                    Value: .jpg
        TopicConfigurations:
          Id: ${env:EVENT_NAME}
            TopicArn: ${env:TOPIC_ARN}
            Events:
              - s3:ObjectCreated:Put
            Filter:
              Key:
                FilterRules:
                  Name: Suffix
                    Value: .gif
        QueueConfigurations:
          Id: ${env:EVENT_NAME}
            QueueArn: ${env:QUEUE_ARN}
            Events:
              - s3:ObjectCreated:Put
            Filter:
              Key:
                FilterRules:
                  Name: Suffix
                    Value: .gif

Usage

# deploy bucket notification configurations 
sls s3deploy 
# The force option removes events with a matching event type and suffix. (prefix not supported) 
sls s3deploy --force
# The remove command deletes events with id that match the resource recorded in the custom in serverless.yaml 
sls s3remove

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i serverless-s3-event

      Weekly Downloads

      12

      Version

      0.2.1

      License

      Apache-2.0

      Unpacked Size

      23.2 kB

      Total Files

      5

      Last publish

      Collaborators

      • hanbyul