maekawa

command module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2017 License: MIT Imports: 12 Imported by: 0

README

maekawa

Build Status Codacy Badge

Maekawa is a cli client for AWS CloudWatch Events has idempotence.

Japanese version is under the English version. (日本語のREADMEが英語の下にあります)

how to install

Download latest binary for your archtecture from releaase page.

https://github.com/unasuke/maekawa/releases

And put that in your $PATH directory.

Or, run this.

$ go get github.com/unasuke/maekawa
macOS

If you using macOS and homebrew, you can install maekawa this command.

$ brew install unasuke/maekawa/maekawa

usage

1. install awscli and run aws configure
2. edit config.yml
rules:
  -
    description: Execute every 5 minutes
    event_pattern:
    name: EveryFiveMinutes
    role_arn:
    schedule_expression: "cron(0/5 * * * ? *)"
    state: ENABLED
    targets:
      -
        arn: arn:aws:lambda:ap-northeast-1:000000000000:function:some-lambda-function
        id: 05c99eea-4059-4294-8583-bb2d00df4226
        input:
        input_path:
  -
    name: TestEvent
    schedule_expression: "rate(2 day)"
    state: ENABLED
    targets:
      -
        arn: arn:aws:lambda:ap-northeast-1:000000000000:function:another-lambda-function
        id: 4c4d91c5-5f8b-4d5f-b28f-3fac49c835ad
        input: |
          { "input": "json input" }
        input_path:
      -
        arn: arn:aws:lambda:ap-northeast-1:00000000000:function:another-lambda-function
        id: 3bde837b-3093-487c-9328-a677e05ae75d
        input: |
          { "input": "some input" }
        input_path:

More example's in sample.yml.

3. run maekawa
$ maekawa --region=ap-northeast-1 --apply --dry-run # check what will changes
$ maekawa --region=ap-northeast-1 --apply # apply config.yml

options

--region

Specify aws region. If set env AWS_REGION, use this. But, --region option is override env.

--profile

Specify aws profile. If set env AWS_PROFILE, use this. But, --profile option is override env.

--apply

Apply your config to AWS CloudWatch Events.

--dry-run

Show what will changes without apply.

--file, -f

Specify config file path. (default config.yml)

--help, -h

Show options.

License

This software is licensed under the MIT License. Please see the LICENSE.txt file for details.

aws-sdk-go

The aws-sdk-go is distributed under the Apache License 2.0.

https://github.com/aws/aws-sdk-go

yaml

The yaml package is distributed under the Apache License 2.0.

https://github.com/go-yaml/yaml


maekawa

maekawaは冪等性を持つAWS CloudWatch Eventsのcli clientです。

インストール方法

最新版リリースの、適したアーキテクチャ向けのバイナリをreleaseページからダウンロードしてください。

https://github.com/unasuke/maekawa/releases

その後、ダウンロードしたバイナリを$PATHの通っている場所に置いてください。

もしくは、以下のコマンドを実行してください。

$ go get github.com/unasuke/maekawa
macOS

もしmacOSとhomebrewを使用している場合、次のコマンドでもインストールできます。

$ brew install unasuke/maekawa/maekawa

使い方

1. awscliのインストールと aws configureの実行
2. config.ymlを編集する
rules:
  -
    description: Execute every 5 minutes
    event_pattern:
    name: EveryFiveMinutes
    role_arn:
    schedule_expression: "cron(0/5 * * * ? *)"
    state: ENABLED
    targets:
      -
        arn: arn:aws:lambda:ap-northeast-1:000000000000:function:some-lambda-function
        id: 05c99eea-4059-4294-8583-bb2d00df4226
        input:
        input_path:
  -
    name: TestEvent
    schedule_expression: "rate(2 day)"
    state: ENABLED
    targets:
      -
        arn: arn:aws:lambda:ap-northeast-1:000000000000:function:another-lambda-function
        id: 4c4d91c5-5f8b-4d5f-b28f-3fac49c835ad
        input: |
          { "input": "json input" }
        input_path:
      -
        arn: arn:aws:lambda:ap-northeast-1:00000000000:function:another-lambda-function
        id: 3bde837b-3093-487c-9328-a677e05ae75d
        input: |
          { "input": "some input" }
        input_path:

sample.ymlに他の例があります。

3. maekawaを実行する
$ maekawa --region=ap-northeast-1 --apply --dry-run # 変更部分の確認
$ maekawa --region=ap-northeast-1 --apply # config.ymlの内容を適用

オプション

--region

AWS regionを指定します。 環境変数にAWS_REGIONが存在する場合それを使用しますが、--regionが指定された場合はそちらで上書きます。

--profile

AWS profileを指定します。 環境変数にAWS_PROFILEが存在する場合それを使用しますが、--profileが指定された場合はそちらで上書きます。

--apply

configに記述された内容をAWS CloudWatch Eventsに適用します。

--dry-run

適用をせずに、何が変更されるかを確認します。

--file, -f

configファイルのpathを指定します。 (デフォルトは config.ymlです)

--help, -h

オプションの一覧を表示します。

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL