adding EventBatchingCondition to CDK trigger

0

Hi team, I want to create a glue trigger via the CDK and associate it with a workflow,

the trigger is of type "EVENT"

I want to add the following config to my trigger via CDK :

"EventBatchingCondition": {
            "BatchSize": 5,
            "BatchWindow": 900
        }

but did not find any object allowing me to add this config to the CfnTrigger.

this is my CDK code :

const glueEdwWorkflowTrigger = new glue.CfnTrigger(
      this,
      "trigger",
      {
        name: "trigger",
        workflowName: myWorkFlow.name,
        type: "EVENT",

        predicate:{conditions:[{}]},
        actions: [
          {
            jobName: myCfnJob.name,
            arguments: {},
          },
        ]
      }
    );

how can I add EventBatchingCondition info to my CfnTrigger?

thanks a lot.

1 Answer
0

Hi there,

As of now the support of EventBatchingCondition property on a trigger is not yet available in CloudFormation, thus CfnTrigger construct does not have such capability neither. You can track this open Github issue for latest update on this feature request. As of now, one workaround can be to use the CDK custom resource AwsCustomResource construct to invoke UpdateTrigger API to add EventBatchingCondition, once the trigger was created.

SUPPORT ENGINEER
answered 2 years ago
  • Thank you for your answer! could you please share with me an example of how can I use AwsCustomResource to UpdateTrigger and add EventBatchingCondition ?

  • Hey there, I don't have any specific example for UpdateTrigger, the you can find some examples here that show the same idea to make API calls in custom resource.

  • Unfortunately, since UpdateTrigger requires you to provide an entirely hydrated TriggerUpdate object (see https://docs.aws.amazon.com/glue/latest/webapi/API_TriggerUpdate.html) which "updates the previous trigger definition by overwriting it completely", you would need some way to invoke GetTrigger first, and get its entire response that you could then modify to include your EventBatchingCondition definition. Unfortunately, if you try to do this with an AwsCustomResource in CDK, there's no good way to get the entire response, as getResponseField only returns a single field from the response, not an entire object.

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