How to use the CloudWatchEvents function from aws-sdk

Find comprehensive JavaScript aws-sdk.CloudWatchEvents code examples handpicked from public code repositorys.

11
12
13
14
15
16
17
18
19
20
logs = new aws.CloudWatchLogs({ region: awsRegion }),
apiGatewayPromise = retriableWrap(new aws.APIGateway({ region: awsRegion })),
s3 = new aws.S3(),
iot = new aws.Iot({ region: awsRegion }),
sns = new aws.SNS({ region: awsRegion }),
events = new aws.CloudWatchEvents({ region: awsRegion }),
cognitoIdentityServiceProvider = new aws.CognitoIdentityServiceProvider({ region: awsRegion }),
destroyRule = function (ruleName) {
        return events.listTargetsByRule({ Rule: ruleName }).promise()
        .then(config => {
fork icon290
star icon0
watch icon3

23
24
25
26
27
28
29
30
31
32
  console.log(chalk.red('AWS_PROFILE not set'));
  console.log('Please add AWS IAM user credentials to ~/.aws/credentials and specify the profile to use with the AWS_PROFILE environment variable');
  return;
}

var cloudwatchevents = new aws.CloudWatchEvents({apiVersion: '2015-10-07'});

var params = {
  Name: 'chaos_lambda_schedule'
};
fork icon26
star icon285
watch icon13

84
85
86
87
88
89
90
91
92
93
var AWS = require('aws-sdk');
// Set the region 
AWS.config.update({region: 'REGION'});

// Create CloudWatchEvents service object
var cwevents = new AWS.CloudWatchEvents({apiVersion: '2015-10-07'});

var params = {
  Name: 'DEMO_EVENT',
  RoleArn: 'IAM_ROLE_ARN',
fork icon80
star icon71
watch icon33

+ 5 other calls in file

2
3
4
5
6
7
8
9
10
11
const AWS = require('aws-sdk')
const signedAxios = require('aws-signed-axios')
const Promise = require('bluebird')
const browser = require('./browser')

const cwEvents = new AWS.CloudWatchEvents({
  endpoint: process.env.CLOUDWATCH_ENDPOINT_URL
})
const s3 = new AWS.S3({ endpoint: process.env.S3_ENDPOINT_URL })
const ssm = new AWS.SSM({ endpoint: process.env.SSM_ENDPOINT_URL })
fork icon21
star icon48
watch icon8

75
76
77
78
79
80
81
82
83
console.log("Triggered");
console.log(event);
console.log(context);

var ec2 = new AWS.EC2();
var cloudwatchevents = new AWS.CloudWatchEvents();
var lambda = new AWS.Lambda();
var ImageId;
var RuleArn;
fork icon19
star icon122
watch icon7

10
11
12
13
14
15
16
17
18
19
const AWS = require('aws-sdk');
const async = require('async');
const AlLogger = require('@alertlogic/al-aws-collector-js').Logger;

function checkCloudWatchEventsRule(event, finalCallback) {
    var cwe = new AWS.CloudWatchEvents();
    async.waterfall([
       function(callback) {
            cwe.describeRule({Name: event.CloudWatchEventsRule}, function(err, data) {
                if (err) {
fork icon16
star icon12
watch icon19

26
27
28
29
30
31
32
33
34
35
  hourly: 'rate(1 hour)',
  daily: 'rate(1 day)'
}

function scheduleBackup (options) {
  let events = new AWS.CloudWatchEvents({ apiVersion: '2015-10-07', region: options.s3Region })
  let lambda = new AWS.Lambda({ apiVersion: '2015-03-31', region: options.s3Region })
  let addPermission = promisify(lambda.addPermission.bind(lambda))
  let listRules = promisify(events.listRules.bind(events))
  let putRule = promisify(events.putRule.bind(events))
fork icon2
star icon3
watch icon5

12
13
14
15
16
17
18
19
20
21
  if (input.creds)  params.credentials = input.creds;
  else if (input.profile) {
    var credentials = new AWS.SharedIniFileCredentials({profile: input.profile});
    AWS.config.credentials = credentials;
  }
  var cloudwatchevents = new AWS.CloudWatchEvents(params);
  return cloudwatchevents;
}

me.listRules = function(input, callback) {
fork icon2
star icon0
watch icon15

2
3
4
5
6
7
8
9
10
11
const aws = require('aws-sdk');
const chalk = require('chalk');
const inquirer = require('inquirer');
const program = require('commander');

const cloudwatch = new aws.CloudWatchEvents();

const {
  getRules,
  chooseRulePrompt,
fork icon1
star icon0
watch icon16