Created
May 18, 2020 13:54
-
-
Save MassimoSporchia/008bb20d72cf92cd594d84abdc3e6c8d to your computer and use it in GitHub Desktop.
Sample Glue Workflow with CDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from "@aws-cdk/core"; | |
import * as glue from "@aws-cdk/aws-glue"; | |
export class GlueStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); | |
var workflow = new glue.CfnWorkflow(this, "glueWorkflow", { | |
name: "testWorkflow", | |
}); | |
var crawler = new glue.CfnCrawler(this, "sampleCrawler", { | |
name: "sampleCrawler", | |
databaseName: "legislators", | |
targets: { | |
s3Targets: [ | |
{ path: "s3://awsglue-datasets/examples/us-legislators/all" }, | |
], | |
}, | |
role: "service-role/AWSGlueServiceRole-test", | |
}); | |
var trigger = new glue.CfnTrigger(this, "onDemandTrigger", { | |
name: "onDemandTrigger", | |
workflowName: workflow.name, | |
actions: [ | |
{ | |
crawlerName: crawler.name, | |
}, | |
], | |
type: "ON_DEMAND", | |
}); | |
trigger.addDependsOn(crawler); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment