在 AWS EC2 上安排作业 [英] Scheduling A Job on AWS EC2

查看:43
本文介绍了在 AWS EC2 上安排作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 AWS EC2 上运行的网站.我需要创建一个夜间作业来生成站点地图文件并将文件上传到各种浏览器.我正在 AWS 上寻找允许此功能的实用程序.我考虑了以下几点:

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 on AWS that allows this functionality. I've considered the following:

1) 向 Web 服务器生成一个请求,触发它执行此任务

1) Generate a request to the web server that triggers it to do this task

  • 我不喜欢这种方法,因为它会占用服务器线程并在主机上使用 CPU 周期

2) 在运行 web 服务器的机器上创建一个 cron 作业来执行这个任务

2) Create a cron job on the machine the web server is running on to execute this task

  • 再说一次,我不喜欢这种方法,因为它占用了 Web 服务器的 CPU 周期

3) 创建另一个 EC2 实例并设置一个 cron 作业来运行任务

3) Create another EC2 instance and set up a cron job to run the task

  • 这解决了 Web 服务器资源问题,但为什么要支付额外的 EC2 实例来运行小于 5 分钟的作业呢?浪费钱!

还有其他选择吗?这是 ElasticMapReduce 的工作吗?

Are there any other options? Is this a job for ElasticMapReduce?

推荐答案

Amazon 刚刚发布了 [1] Elastic Beanstalk 的新功能.您现在可以创建一个包含 cron.yaml 的工作环境,该环境配置调用具有 CRON 语法的 URL 的调度任务:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html#worker-periodictasks

Amazon has just released[1] new features for Elastic Beanstalk. You can now create a worker environment containing cron.yaml that configures scheduling tasks calling an URL with the CRON syntax: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html#worker-periodictasks

[1] http://aws.amazon.com/about-aws/whats-new/2015/02/17/aws-elastic-beanstalk-supports-environment-cloning-periodic-tasks-and-1-click-iam-role-creation/

这篇关于在 AWS EC2 上安排作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆