Salta al contenuto

EventBridge - use wildcards in InputPathsMap

0

Hello, we are using event based system with different versions of corresponding contexts and I would like to use wildcards/regex to match multiple context version (e.g. '$.detail.contexts_io_upheal_session_15[0].source', '$.detail.contexts_io_upheal_session_16[0].source', etc.). I tried the following in InputPathsMap "source": '$.detail.contexts_io_upheal_session_*[0].source' "source": '$.detail.contexts_io_upheal_session_\\d+[0].source'

Thank you

posta un anno fa201 visualizzazioni

1 Risposta
0

EventBridge doesn't support wildcards or regex patterns directly in the InputPathsMap for input transformers. The InputPathsMap requires exact JSON path expressions to extract specific values from your events.

Refer: https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_InputTransformer.html

Please consider the following workarounds, if that works for your use-case:

  1. Create separate mappings for each version you need to support:
"source_v15": "$.detail.contexts_io_upheal_session_15[0].source",
"source_v16": "$.detail.contexts_io_upheal_session_16[0].source"
  1. Use an input transformer to transform your events before they reach their destination. Input transformers allow you to map specific EventBridge fields to corresponding attributes in your target format.

  2. Consider using a more generic event pattern to catch all relevant events, and then handle the version-specific processing in your target Lambda function or other service.

For example, you could use an event pattern like:

{
"detail-type": ["YourDetailType"],
"source": ["your-source"]
}

This would match all events of the specified detail-type and source, regardless of the session version, and then your target could handle the version-specific processing.
Sources
Sending and receiving CloudEvents with Amazon EventBridge | AWS Compute Blog
Creating event patterns in EventBridge - Amazon EventBridge

con risposta un anno fa

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.