I'm using the AWS CDK. When I deploy, according to CloudFormation Events in the AWS console, resources(CfnTrigger) in createWorkflow are initialized before createDDBCrawler and createS3Crawler. Which is causing create_failed(Entity not found) since createWorkflow depends on resources in these two.
So I am wondering:
AWS CDK resource generating sequence (since I see no
asyncorpromisein functions, so TypeScript is handling the code in sequence. Then it's a CDK/CloudFormation behavior?)How to avoid this or arrange resource create sequence, except creating two stack.
export class QuicksightGlue extends Construct {
constructor(scope: Construct, name: string, props: QuicksightGlueProps) {
super(scope, name);
this.createGlueDb(props.glueDb);
for (let zone of zones) {
const ddbCrawler = this.createDDBCrawler(...);
const etlJob = this.createEtlJob(...);
// crawler for processed data
this.createS3Crawler(...);
// create workflow that use crawler
this.createWorkflow(...);
}
}
private createS3Crawler(...) {
return new glue.CfnCrawler(this, 's3Crawler_' + zone, {
name: 's3Crawler_' + zone,
databaseName: glueDb,
role: roleArn,
targets: {
s3Targets: [{ path: s3 }]
}
});
}
private createWorkflow(...) {
const extracDdbWorkflow = new glue.CfnWorkflow(this, `ExtractDdb_` + zone, {
name: `udhcpExtractDdb_` + zone.toLowerCase(),
description: "Workflow to extract and process data from DDB"
});
const scheduledTriggerDdbCrawler = new glue.CfnTrigger(this, 'DdbTrigger_' + zone, {
workflowName: extracDdbWorkflow.name,
type: "SCHEDULED",
schedule: scheduleCronExpression, //"cron(0 * * * ? *)",
description: "Trigger to start the workflow every hour to update ddb data",
actions: [{
crawlerName: ddbCrawler,
}],
});
...
createWorkflowandcreateS3Crawler? - user16442705