#batch #aws #sns #cloudwatch-events

watchrs

Crate that aids in monitoring and setting up alerts for AWS Batch Jobs

3 unstable releases

0.2.1 Apr 24, 2019
0.2.0 Apr 24, 2019
0.1.0 Apr 23, 2019

#7 in #sns

24 downloads per month

MIT/Apache

22KB
315 lines

watchrs

Crates.io Documentation Build Status

watchrs is a crate that aids in monitoring and setting up alerts for AWS Batch Jobs.

Note: This is still under development and I would not consider it to be production ready yet.

Examples

Setting Up Alerts For Batch Job State Changes

use watchrs::Watcher;

// First create and subscribe to a topic
let watcher = Watcher::default();
watcher
    .subscribe("youremail@example.com".to_owned(), None)
    .and_then(|(topic_arn, _)| {
        watcher
            .create_job_watcher_rule(
                "my_batch_job_rule".to_owned(),
                // enable?
                true,
                Some("watch failed jobs".to_owned()),
                Some(vec!["FAILED".to_owned(), "RUNNABLE".to_owned()]),
                Some(vec!["JOB_QUEUE_ARN".to_owned()]),
                Some(vec!["JOB_DEFINITION_NAME".to_owned()])
            )
            .map(|rule_name| (topic_arn, rule_name))
    })
      .and_then(|(topic_arn, rule_name)| {
           // create target
           watcher.create_sns_target(rule_name, topic_arn)
    })
    .expect("failed to create alerting system");

Requirements

  • AWS Account
  • AWS CLI configured

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~20MB
~381K SLoC