adding etl workflow to event rule
Hi team,
I want to add a glue workflow as a target to my rule
import * as events from "@aws-cdk/aws-events";
const rule = new events.Rule(
this,
"object_created_event",
{
description:
"description here....",
ruleName: "newObj",
enabled: true,
eventPattern: {
source: ["aws.s3"],
detailType: ["Object Created"],
detail: {
bucket: {
name: ["test_bucket"],
},
},
},
}
);
rule.addTarget(new targets.....);
I can't find glue workflow as a target on the targets list so that I can add it as a target to my rule.
is there any other way to do it other than using ..addTarget method?
thank you.
I was able to do it using the CfnRule construct :
new events.CfnRule(
this,
"rule",
{
....
targets: [
{
arn: `arn:aws:glue:${Aws.REGION}:${Aws.ACCOUNT_ID}:workflow/${myworkFlow.name}`,
id: "some_id",
roleArn: myRole.roleArn,
},
],
}
);
Hello,
Unfortunately, Glue workflow is not a supported target for AWS CDK aws_events module as shown here https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events-readme.html I could also see a feature request was opened recently here https://github.com/aws/aws-cdk/issues/18853
An alternative is to write a simple Lambda function to start a Glue workflow using boto3 client and choose this lambda function as a target.
Glue start workflow boto3 client https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/glue.html#Glue.Client.start_workflow_run
However , both AWS events cli and events boto3 does support Glue workflow as a target.
References:
1. AWS events cli put-targets https://awscli.amazonaws.com/v2/documentation/api/latest/reference/events/put-targets.html
2. AWS events boto3 put-targets https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/events.html#EventBridge.Client.put_targets
3. Starting AWS Glue workflow with eventbridge CLI https://docs.aws.amazon.com/glue/latest/dg/starting-workflow-eventbridge.html
Relevant questions
'aws events list-targets-by-rule' response incomplete
asked 3 years agoInvoke a lambda function (cross account) from event bridge
Accepted Answerasked 5 months agoAre EventBridge events (fully) passed to Glue Workflows?
asked 3 months agoEventbridge Input Transformer example doesnt work
asked 9 days agotrigger glue job from s3
Accepted Answerasked a month agoCall a glue Job from within another without using vpc endppoints or SG
asked 3 months agoCDK AWS trigger with type EVENT
asked a month agoadding etl workflow to event rule
Accepted Answerasked a month agoCloudwatch Rule Failed Invocation
asked 5 years agoDMS events not triggering Event Bridge Rule
asked 4 months ago