Coder Social home page Coder Social logo

aws-event-mock's Introduction

aws-event-mock

A simple tool to quickly mockup aws test events like cloudwatch logs or sns events

Usage

Usage:
  aws-event-mock [command]

Available Commands:
  create      returns a valid aws event in json format
  help        Help about any command

Flags:
  -h, --help      help for aws-event-mock
      --version   version for aws-event-mock

Examples

aws-event-mock create --message --type cloudwatch-log --message '{"message":"i am a cloudwatch log event. send me to lambda!"}' | jq
{
  "awslogs": {
    "data": "H4sIAAAAAAAA/0SNT0+EMBBHv8vv3E1atrq7vZGIXPQEN0MMyoQ0obRpB40hfHfDH93jmzfzZob/HinCQGVn/fB4ud5UdobA4Psy+inAgCnxyx9upuJIrburgwXS9JE+ow1s/fhsB6aYYN62tR3RCDhKqe2p/gkEg6e8zt9fi6rKy2KvF1808no3w3bHE1pntlMQYOsocesCjNJaap3drhcp5X8YBqcTr/WlWX4BAAD//wEAAP//obAJk+EAAAA="
  }
}
# from file use '@' before file path (supports relative or absolute)
aws-event-mock create --type cloudwatch-log --message "@/some/filepath"
{
  "awslogs": {
    "data": "H4sIAAAAAAAA/0SNT0+EMBBHv8vv3E1atrq7vZGIXPQEN0MMyoQ0obRpB40hfHfDH93jmzfzZob/HinCQGVn/fB4ud5UdobA4Psy+inAgCnxyx9upuJIrburgwXS9JE+ow1s/fhsB6aYYN62tR3RCDhKqe2p/gkEg6e8zt9fi6rKy2KvF1808no3w3bHE1pntlMQYOsocesCjNJaap3drhcp5X8YBqcTr/WlWX4BAAD//wEAAP//obAJk+EAAAA="
  }
}

aws-event-mock create --type sns --message '{"message":"i am an sns message. send me to lambda!"}' | jq
{
  "Records": [
    {
      "EventVersion": "1.0",
      "EventSubscriptionArn": "arn:aws:sns:us-east-1:{{{accountId}}}:ExampleTopic",
      "EventSource": "aws.sns",
      "Sns": {
        "Signature": "EXAMPLE",
        "MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e",
        "Type": "Notification",
        "TopicArn": "arn:aws:sns:us-east-1:{{{accountId}}}:ExampleTopic",
        "MessageAttributes": {
          "Test": {
            "Type": "String",
            "Value": "teststringvalue"
          }
        },
        "SignatureVersion": "1",
        "Timestamp": "2021-11-30T22:08:23.379513Z",
        "SigningCertUrl": "EXAMPLE",
        "Message": "{\"message\":\"i am an sns message. send me to lambda!\"}",
        "UnsubscribeUrl": "EXAMPLE",
        "Subject": "example subject"
      }
    }
  ]
}

Roadmap

  • Add more event types
    • Cloudwatch Log
    • Cloudwatch
    • SNS
    • S3
    • Dynamo
    • API Gateway

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.