@mhlabs/evb-local
A CLI tool for local ingestion of a CloudFormation stack's EventBridge rules
Last updated 20 days ago by mhlabs .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mhlabs/evb-local 
SYNC missed versions from official npm registry.

evb-local

Tool that lets you subscribe locally to events matching EventBridge rules in a given deployed stack. This is to help with debugging of complex flow of events raised in your applicaton.

Backend setup (once per AWS account)

  1. Make sure you have either aws-cli or sam-cli installed.
  2. Clone this repo
  3. Go to the ./sam-folder
  4. npm -i --only=prod
  5. Deploy template.yaml sam deploy -t template.yaml --guided --stack-name evb-local

CLI setup

Prerequisites:

  • Valid AWS credentials that at the least has permissions to do the following (or an SSO role configured with at least the same):
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Statement1",
      "Effect": "Allow",
      "Action": [
        "cloudformation:ListStackResources"
      ],
      "Resource": [
        "arn:aws:cloudformation:<region>:<accountid>:stack/evb-local",
        "arn:aws:cloudformation:<region>:<accountid>:stack/evb-local/*"
      ]
    }
  ]
}

Install CLI npm install -g @mhlabs/evb-local

Usage

Usage: evb-local [options] [command]

Options:
  -v, --vers                        output the current version
  -h, --help                        display help for command

Commands:
  listen|l [options] [StackName]    Initiates local consumption of a stack's EventBridge rules
  test-rule|t [options] [RuleName]  Initiates local consumption of an undeployed EventBridge rule
  configure-sso [options]           Configure authentication with AWS Single Sign-On
  help [command]                    display help for command

Usage of listen command

This command can be used to create alocal consumer of all deployed EventBrudge rule in a stack. The events will be outputed in your console with the option to pass them on to sam-local for local debugging.

Demo

Usage: evb-local listen|l [options] [stackName]

Initiates local consumption of a stacks EventBridge rules

Options:
  -c, --compact [compact]  Output compact JSON on one line (default: "false")
  -s, --sam-local [sam]    Send requests to sam-local (default: "false")
  --sso                    Authenticate with AWS SSO. Set environment variable EVB_CLI_SSO=1 for
                           default behaviour
  -h, --help               display help for command

Usage of test-rule command

This command can be used to quickly test rules from you SAM/CloudFormation template before deploying it. The matching events will be outputed instantly in your console with the option to pass them on to sam-local for local debugging.

Demo

Usage: evb-local test-rule|t [options] [RuleName]

Initiates local consumption of an undeployed EventBridge rule

Options:
  -t, --template-file [templateFile]  Path to template file (default: "template.yml")
  -c, --compact [compact]             Output compact JSON on one line (default: "false")
  -s, --sam-local [sam]               Send requests to sam-local (default: "false")
  -h, --help                          display help for command

Example output

{
  "Target": <RuleTarget>,
  "Body": {
    <EventPayload>
  }
}

Where:

  • RuleTarget is the name identifier of the EventBridge rule's target. If this exists in the same stack it will display the CloudFromation LogicalID
  • EventPayload is the payload of the event

Current Tags

  • 1.0.4                                ...           latest (20 days ago)

4 Versions

  • 1.0.4                                ...           20 days ago
  • 1.0.3                                ...           20 days ago
  • 1.0.2                                ...           a month ago
  • 1.0.1                                ...           a month ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 37
Dependencies (9)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |