Home > Mobile >  AWS Glue Schedule a Job with Cli
AWS Glue Schedule a Job with Cli

Time:05-06

I would like to ask how can I schedule a AWS Glue job from AWS cli or boto3.

I couldn't find it in the official enter image description here

I know there is another way that includes creating a Trigger linked to the job, but not I'm not sure which it's the recommended one.

Thank you in advance.

CodePudding user response:

Best (subjective) and the only way I'm aware of and that's documented by AWS is to do it by creating a JSON file first, for example:

{
  "Name": "your_schedule",
  "Description": "AWS GLUE docs suck",
  "Schedule": "cron(0 12 * * ? *)",
  "Actions": [
    {
      "JobName": "test_job"
    }
  ]
}

and then supply it as an argument to the aws glue, like this:

aws glue create-trigger --type SCHEDULED --cli-input-json file://your_job_schedule.json

If you got all the bits right, the output should be like this:

{
    "Name": "your_schedule"
}

Full syntax for the JSON file is here.

The docs you need are:

  • Related