Jiew Meng
Jiew Meng

Reputation: 88367

Lambda to monitor multi region AWS changes/events

Currently I am using Lambda to autotag/start/stop my instances. But I find that that appear to be region specific. Do I need to deploy it on every region if I want to do the same thing on every region? Is there a better way?

Even then some regions don't have lambda?

Upvotes: 1

Views: 547

Answers (1)

user818510
user818510

Reputation: 3652

You don't need a lambda in every region. You just need to change the region in your service config object which can be set like this:

var ec2 = new AWS.EC2({region: 'eu-west-1'});

OR

AWS.config.update({region:'eu-west-1'});

You'll need to use an array consisting of all the regions you need to monitor, iterate through them, set the AWS configuration to the target region and then perform your operations. Just make sure to set the region in configuration before you autotag/start/stop your instances so that the operations would be performed in your desired region.

Upvotes: 3

Related Questions