Scheduling A Job on AWS EC2

前端 未结 7 703
眼角桃花
眼角桃花 2020-12-24 14:52

I have a website running on AWS EC2. I need to create a nightly job that generates a sitemap file and uploads the files to the various browsers. I\'m looking for a utility o

7条回答
  •  攒了一身酷
    2020-12-24 15:29

    AWS DataPipeline

    You can use AWS Data Pipeline to schedule a task with a given period. The action can be any command when you configure your Pipeline with the ShellCommandActivity.

    You can even use your existing EC2 instance to run the command: Setup Task Runner on your EC2 instance and set the workerGroup field when setting the ShellCommandActivity (doc) on your DataPipeline:

    {
     "pipelineId": "df-0937003356ZJEXAMPLE",
     "pipelineObjects": [
        {
          "id": "Schedule",
          "name": "Schedule",
          "fields": [
            { "key": "startDateTime", "stringValue": "2012-12-12T00:00:00" }, 
            { "key": "type", "stringValue": "Schedule" }, 
            { "key": "period", "stringValue": "1 hour" }, 
            { "key": "endDateTime", "stringValue": "2012-12-21T18:00:00"  }
           ]
         }, {
          "id": "DoSomething",
          "name": "DoSomething",
          "fields": [
            { "key": "type", "stringValue": "ShellCommandActivity" },
            { "key": "command", "stringValue": "echo hello" },
            { "key": "schedule", "refValue": "Schedule" },
            { "key": "workerGroup", "stringValue": "yourWorkerGroup" }
          ]
        }
      ]
    }
    

    Limits: Minimum scheduling interval is 15 minutes.
    Pricing: About $1.00 per month.

提交回复
热议问题