Code Monkey home page Code Monkey logo

s3touch's Introduction

๐ŸŒ‡ As of January 2020, this module is deprecated. It is provided as-is, with no warranty. We are not accepting new bugfixes or feature requests at this time.

s3touch

s3touch

Utility to simulate S3 events without actually re-PUTing objects to S3.

Usage: s3touch <s3 path> [--topic <arn string>]

# touch a single object
s3touch s3://my-bucket/some-object

# touch all objects under a prefix
s3touch --recursive s3://my-bucket/some-prefix/

# touch a single object with custom SNS topic
s3touch s3://my-bucket/some-object --topic arn:aws:sns:us-east-1:1234:this-bucket-s3-events
  • Looks up SNS topic that is subscribed to the given S3 bucket,
  • Looks up information about some-object (size, etag),
  • and sends a simulated S3 event message to the SNS topic already set within the bucket or to the SNS topic explictly sent via the --topic flag

Install

npm install -g s3touch

s3touch's People

Contributors

jjanczyszyn avatar perrygeo avatar rclark avatar tmcw avatar yhahn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s3touch's Issues

Add --topic option

Add --topic option to allow notifications to be triggered on buckets that don't have notifications configured.

s3touch --recursive s3://my-bucket/some-prefix/ --topic <arn>

/cc @yhahn @camillacaros

Allow subject to be passed in.

Currently s3Touch allows you to simulate an s3 object event through SNS, but it doesn't use a lot of the features of SNS. I imagine this is because you want to simulate an S3 event rather than an SNS event. However, I'd like to be able to pass a lambda command string in via the subject line. Would it be okay to add some parameters in the createMessage/publishEvent functions to add a subject line to the SNS event? Default could be "s3touch".

enable bucket region lookup in createMessage()

I've run into the problem of wanting to s3touch an item in an s3bucket located in us-east-1 & send work message to an SNS topic that is in us-west-2. I've set env var AWS_DEFAULT_REGION=us-west-2 to override default region var in s3touch so that we have proper access to the SNS topic in us-west-2.

However, this region var also gets used in the createMessage() function to relay bucket & object information in the headObject request. This means, if default region is set to us-west-2, we are unable to access objects in us-east-1 and receive Error: Could not HEAD object ("301")

In order to change this behavior, I'm going to work on updating the createMessage() function to lookup region for object request based on the region its parent bucket is housed in.

This should be able to be accomplished with an getBucketLocation call

cc @yhahn

Question: Can you s3touch an entire bucket

Hi,
Thanks for a great program, really useful.

I wanted to ask if there is an easy way to use it for every object in a bucket and not have to use a prefix?

Thanks
Dave

Error: Cannot read property 'Topic' of undefined

I touch a single file in S3 bucket

s3touch s3://bucket/folder/file.jpg

and get this error:

/usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/request.js:30
            throw err;
            ^

TypeError: Cannot read property 'Topic' of undefined
    at Response.<anonymous> (/usr/local/lib/node_modules/s3touch/index.js:34:56)
    at Request.<anonymous> (/usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/request.js:353:18)
    at Request.callListeners (/usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/request.js:595:14)
    at Request.transition (/usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/request.js:21:10)
    at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/request.js:37:9)
    at Request.<anonymous> (/usr/local/lib/node_modules/s3touch/node_modules/aws-sdk/lib/request.js:597:12)

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.