Amazon EventBridge Rules error with Lambda

0

Hi Everybody, I have 2 environments: STG and PROD. I using Medialive for Livestream. I've created below:

Environment STG:
Amazon EventBridge => Lambda function handler event Medialive
Environment PROD:
Amazon EventBridge => Lambda function handler event Medialive

Amazon EventBridge STG and Amazon EventBridge PROD have the same rules like:

{
  "source": ["aws.medialive"],
  "detail-type": ["MediaLive Channel State Change"]
}

When I config above. I found that events Amazon EventBridge environment STG in Lambda PROD, or opposite events Amazon EventBridge environment PROD in Lambda STG. This leads to conflict when operating my website.

Please explain or help me fix my issues. Thank you so much.

2 Risposte
0

Recommended option is to create different accounts for the different environments. If you use a single account, each environment should have its own Event Bus in EventBridge. PROD functions will create the rule on the PROD bus and STG functions will create the rule on the STG bus. The functions that send events to the event bus will use an environment variable with the ARN of the bus.

profile pictureAWS
ESPERTO
Uri
con risposta 2 anni fa
  • Hi Bro, Please let me know, with event same: { "source": ["aws.medialive"], "detail-type": ["MediaLive Channel State Change"] } How to config with eventbus. Thank you

  • The events will be the same in both buses, but you write them to different buses. As you can see in the PutEvents API, there is a field there for the event bus name. This will be different for the different environments.

0

I am assuming you are using the same Account ID for both environments. This may explain your experience.

If that is the case, you would have to further filter the rule by the ARN of the channel. Essentially you would have something like so:

{
"source": ["aws.medialive"],
  "detail-type": ["MediaLive Channel State Change"]
  "detail": {
    "channel_arn": ["<staging-channel-arn>"]
  }
}

and

{
"source": ["aws.medialive"],
  "detail-type": ["MediaLive Channel State Change"]
  "detail": {
    "channel_arn": ["<production-channel-arn>"]
  }
}

You can find the schema for this event here -> https://us-east-2.console.aws.amazon.com/events/home?region=us-east-2#/registries/aws.events/schemas/aws.medialive%40MediaLiveChannelStateChange/version/1

con risposta 2 anni fa
  • Hi bro, Because I will create many channels. Channel is not static, each environment will create when the client requests so can't specify channel ARN.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande