By using AWS re:Post, you agree to the Terms of Use

AWS Location Tracker - custom event-bus setting

0

I am trying to control which event-bus an AWS Tracker goes onto. I looked at the API Docs and I did not see anything like an "event-bus" as part of it's parameters. In my testing it seems that the Event Bus rule uses the "default" bus every time for an "ENTER" or "EXIT" event. We use various event-bus' per environment. Is there any way I can configure my API call to point to a specific event-bus? Here is a sample snippet I am currently using:

var paramsUpdateTracker = {
  TrackerName: 'test-tracker',
  Updates: [
    {
      DeviceId: 'fake-device-number',
      Position: [-90.22222,41.888888],
      SampleTime: new Date,
    }
  ]
};
  
location.batchUpdateDevicePosition(paramsUpdateTracker, function(err: any, data: any) {
  if (err) {
    console.log(err, err.stack);
  }
  else     {
    console.log(data);
  }
});
asked 3 months ago50 views
3 Answers
1

By default, events generated by AWS services get sent to the default event bus in Eventbridge. The custom event bus will be used for custom code (if you use the Eventbridge APIs to send events from your code). It is however possible to send an event from one bus to another - https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-bus-to-bus.html

profile picture
EXPERT
answered 3 months ago
  • So it sounds like all ENTER/EXIT events for AWS Location will always be routed to the "default" bus, and there is no way to programmatically put that event on a specific EventBridge bus. I was hoping to avoid a scenario like this, but sounds like we may have no other choice. Just to be clear, what you are suggesting is that all Location events for geofence ENTER/EXIT will go to the default bus, and from there we can route traffic to the proper environment EventBridge bus (dev/qa/production/etc...)?

0

On the last sentence, are you using the same AWS account for all your environments? This is not a recommended practice. Ideally, all environments should be in their own AWS accounts. Sometimes customers do use the same AWS account for lower environments such as Dev and Test, but then use separate accounts for Pre-prod and Prod. At the minimum, production accounts should be separate from non-production accounts. Even if you share the same AWS account between different environments, the workloads should be kept separate. That is however difficult if you are using Eventbridge default event bus because there can be only one default event bus in one AWS account. How would you know if an event on the default event bus is meant for the Dev environment or the Test environment? This needs to be thought through more.

profile picture
EXPERT
answered 3 months ago
  • We actually do have a separate account for production and one for lower environments. The account for lower environments includes development/qa/stage. We do currently use EDA for other use cases. The EventBridge API is used which includes the actual name of the target bus. Here is a sample setup:

        const entry: EventBridge.PutEventsRequestEntry = {
          Source: <domainName>,
          DetailType: <eventName>,
          EventBusName: <busName>,
          Detail: JSON.stringify(request),
        };
    
0
  1. Reacting to Amazon Location Service events with Amazon EventBridge : https://docs.aws.amazon.com/location/latest/developerguide/location-events.html
  2. Tracking using MQTT with Amazon Location Service : https://docs.aws.amazon.com/location/latest/developerguide/tracking-using-mqtt.html
answered 3 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions