

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 步骤 4：（可选）创建触发器以安排导出作业
步骤 4：（可选）安排导出任务

要定期运行在上一步中创建的导出任务，可以创建定时触发器。有关更多信息，请参阅《 Amazon Glue 开发人员指南》中的[Amazon Glue 触发器](https://docs.amazonaws.cn/glue/latest/dg/about-triggers.html)。

**安排作 Amazon Glue 业**

1. 以下 Amazon CLI 命令是一个简单触发器的示例，该触发器的名称`KeyspacesExportWeeklyTrigger`为每周星期一 12:00 UTC 运行`AmazonKeyspacesExportToS3-cfn-setup-cfn-glue`一次同名 Amazon Glue 作业。

   ```
   aws glue create-trigger \
     --name KeyspacesExportWeeklyTrigger \
     --type SCHEDULED \
     --schedule "cron(0 12 ? * MON *)" \
     --start-on-creation \
     --actions '[{
        "JobName": "AmazonKeyspacesExportToS3-cfn-setup-cfn-glue"
     }]'
   ```
   + 要覆盖计划作业的任何默认设置，可以将其作为参数传递。在此示例中，我们通过将密钥空间名称、表名、工作人员数量和工作器类型作为参数传递来覆盖它们。下面是一个命令示例。

     ```
     aws glue create-trigger \
       --name KeyspacesExportWeeklyTrigger \
       --type SCHEDULED \
       --schedule "cron(0 12 ? * MON *)" \
       --start-on-creation \
       --actions '[{
          "JobName": "AmazonKeyspacesExportToS3-cfn-setup-cfn-glue",
          "Arguments": {
            "--number-of-workers": "8",
            "--worker-type": "G.2X"},
            "--table_name": "my_table",
            "--keyspace_name": "my_keyspace"
       }]'
     ```

1. 要确认触发器已创建，请使用以下命令。

   ```
   aws glue list-triggers
   ```

   该命令的输出应类似于此。

   ```
   {
       "TriggerNames": [
           "KeyspacesExportWeeklyTrigger"
       ]
   }
   ```

要清理在本教程中创建的 Amazon 资源，请继续[第 5 步：（可选）清理](S3-tutorial-step5.md)。