CloudFormation: a way to define an ACTIVATED scheduled Glue job trigger
For anyone new looking, this can be achieved now by using the StartOnCreation property for new triggers.
UEDDBJobTrigger:
Type: AWS::Glue::Trigger
Properties:
Name: Foo
Description: Scheduled trigger
Type: SCHEDULED
Schedule: "cron(0 10 ? * MON-FRI *)"
StartOnCreation: true
Actions:
- JobName: !Ref TestJob
Had the same issue and opened up a ticket with AWS. Looks like they currently do not have the feature but are looking to address in their next feature release. Below is their response:
Thank you for contacting AWS premium support. It was a pleasure speaking with you today. I am writing back to followup on our conversation. I was able to get in touch with members of the Glue team and the Cloud Formation team following are my findings:
1) It looks like there isn't away to enable the Glue trigger using the resource namespace: AWS::Glue::Trigger
2) The scheduled jobs should retry on the next scheduled time if the first time it does so fails
3) As a work around to the above, what you could do is have the scheduled actions trigger a certain length of time after the stack is created in order for you to manually enable the trigger through the web console.
4) As discussed during our call, it looks like a Lambda function could in fact be feasible. In this case you can have the Lambda Function depend on the Trigger resource and then make the API call start-trigger (https://docs.aws.amazon.com/cli/latest/reference/glue/start-trigger.html) using the lambda function to enable the trigger. These actions should occur in time for the scheduled jobs to be triggered.
Following are some useful references for Lambda and Cloud Formation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough-custom-resources-lambda-lookup-amiids.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html