npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

s3events

v0.0.13

Published

Command line tool to resend AWS S3 events to new or existing event handlers

Downloads

29

Readme

s3events

npm version Build Status

s3events is a command line tool to simulate and send AWS S3 events to new or existing event handlers. Supports SNS, SQS, Lambda.

Sample use cases:

  • Resend s3 object created events to event handlers.
  • Simulate object removal events without deleting objects.

Installation

npm install -g s3events

Send object creation events in prefix to all attached event handlers

Usage: s3events notify-all <event> <s3Path>
--event   Event type[required] [choices: "ObjectCreated:*", "ObjectRemoved:*", "ReducedRedundancyLostObject"]
--s3Path  Example: s3://prefix

# Example
s3events notify-all ObjectCreated:* s3://bucket-name/data/2017/07/01/18

# Use --dryrun flag to see actions without sending notification
s3events notify-all ObjectCreated:* s3://bucket-name/data/2017/07/01/18 --dryrun

Send object creation events in prefix to another SNS topic

Usage: s3events notify-sns <event> <topicArn> <s3Path>
--event     Event type
                    [required] [choices: "ObjectCreated:*", "ObjectRemoved:*", "ReducedRedundancyLostObject"]
--topicArn  SNS topic ARN
--s3Path    Example: s3://prefix

# Example
# Use --suffix flag to selectively send objects
s3events notify-sns ObjectCreated:* arn:aws:sns:us-east-1:123456789:SNSTopicName s3://bucket-name/data/2017/07/01/18 --suffix .gz

Sample S3 event

  • Not all the fields of the official S3 event are sent, for example: awsRegion, userIdentity, requestParameters, etc are not sent.
  • Only the following fields are sent.
{
  "Records": [{
    "eventVersion": "2.0",
    "eventName": "s3:ObjectCreated:*",
    "eventTime": "2017-07-24T11:13:52.418Z",
    "eventSource": "aws:s3",
    "s3": {
      "s3SchemaVersion":"1.0",
      "bucket": {
        "name": "bucket-name",
        "arn": "arn:aws:s3:::bucket-name"
      },
      "object": {
        "key": "path/to/the/object.json",
        "size": 1487143,
        "etag": "\"bb72de632950eaf6d9ac9c828e3bbd1c\""
      }
    }
  }]
}

Usage Overview

$ s3events --help
Commands:
  notify-all <event> <s3Path>               Send event for each object in the
                                            path, to all event handlers of the
                                            bucket (SNS,SQS,Lambda).
  notify-lambda <event> <functionArn>       Send event for each object in the
  <s3Path>                                  path, to a Lambda function.
  notify-sns <event> <topicArn> <s3Path>    Send event for each object in the
                                            path, to a SNS topic.
  notify-sqs <event> <queueArn> <s3Path>    Send event for each object in the
                                            path, to a SQS queue.
  show-config <s3Bucket>                    Print notification configurations of
                                            a S3Bucket.

Options:
  --help  Show help                                                    [boolean]

Run from source

yarn
npm link --local
s3events --help

# Running tests
export TMPDIR=/private$TMPDIR # OSX only
npm test