Skip to content

Instantly share code, notes, and snippets.

@MassimoSporchia
Created May 18, 2020 13:54
Show Gist options
  • Save MassimoSporchia/008bb20d72cf92cd594d84abdc3e6c8d to your computer and use it in GitHub Desktop.
Save MassimoSporchia/008bb20d72cf92cd594d84abdc3e6c8d to your computer and use it in GitHub Desktop.
Sample Glue Workflow with CDK
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