简体   繁体   English

我可以同时运行1000个AWS微实例吗?

[英]Can I run 1000 AWS micro instances simultaneously?

I have a simple pure C program, that takes an integer as input, runs for a while (let's say an hour) and then returns me a text file. 我有一个简单的纯C程序,它接受一个整数作为输入,运行一段时间(假设一小时),然后返回一个文本文件。 I want to run this program 1000 times with input integers from 1 to 1000. 我想用1到1000的输入整数运行这个程序1000次。

Currently I'm running this program in parallel (4 processors), what takes 250 hours. 目前我正在并行运行这个程序(4个处理器),需要250个小时。 The program is such that it fits in a AWS micro instance (I've tested it). 该程序适合AWS微实例(我已经测试过)。 Would it be possible to use 1000 micro instances in AWS to do the whole job in one hour? 是否可以在AWS中使用1000个微实例在一小时内完成整个工作? (at a cost of ~20$ - $0.02/instance)? (费用约为20美元 - 0.02美元/例)?

If it is possible, does anybody have some guidlines on how to do that? 如果有可能,是否有人对如何做到这一点有一些指导? If it is not, does anybody have an also low-budget alternative to that? 如果不是,那么是否还有一个低预算的替代品呢?

Thanks a lot! 非常感谢!

In order to achieve this, you will need to: 为了实现这一目标,您需要:

  • Create a S3 bucket to store your bootstrapping scripts, application, input data and output data 创建S3存储桶以存储引导脚本,应用程序,输入数据和输出数据

  • Custom Lightweight AMI: you might want to create a custom lightweight AMI which knows about downloading the bootstrapping script 自定义轻量级AMI:您可能希望创建一个自定义轻量级AMI,它知道下载引导脚本

  • Bootstrapping Script: will download your software from your S3 bucket, parse a custom instance tag which will contain the integer [1..1000] and download any additional data. 引导脚本:将从S3存储桶下载您的软件,解析包含整数[1..1000]的自定义实例标记并下载任何其他数据。

  • Your application: does the processing stuff. 您的应用程序:处理过程。

  • End of processing script is which uploads the result to a another result S3 bucket and terminates the instance , you might also want to send a SNS notification to communicate the end of processing status. 处理结束脚本将结果上传到另一个结果S3存储桶并终止实例 ,您可能还希望发送SNS通知通知处理状态的结束。

  • If you need result consolidation you might want to create another instance and use it as a coordinator, waiting for all "end of processing" notifications in order to finish the processing. 如果您需要结果合并,您可能需要创建另一个实例并将其用作协调器,等待所有“处理结束”通知以完成处理。 In this case you might consider using in the future the Amazon's Hadoop map reduce engine, since it will do almost all this heavy lifting for free. 在这种情况下,您可能会考虑将来使用亚马逊的Hadoop地图减少引擎,因为它将免费提供几乎所有这些繁重的工作。

You didn't specify what language you'd like to do this in and since the app you use to deploy your program doesn't have to be in the same language I would recommend C#. 您没有指定您想要执行此操作的语言,因为您用于部署程序的应用程序不必与我推荐的C#语言相同。 There are a number of examples around the web on how to programmatically spawn new Amazon Instances using the SDK. Web上有很多关于如何使用SDK以编程方式生成新的Amazon实例的示例。 For example: 例如:

How to start an Amazon EC2 instance programmatically in .NET 如何在.NET中以编程方式启动Amazon EC2实例

You can create your own AMIs with the program already present but that might end up being a pain if you want to make adjustments to it since it will require you to recreate the entire AMI. 您可以使用已存在的程序创建自己的AMI,但如果您想对其进行调整,可能最终会感到痛苦,因为它需要您重新创建整个AMI。 I'd recommend creating an extra instance or simply hosting the program in a location which is accessible from a public URL. 我建议创建一个额外的实例,或者只是将程序托管在可从公共URL访问的位置。 Then I would create some kind of service which would be installed on the AMI ahead of time to allow me to specify the URL to download the app from along with whatever command line parameters I wanted for that particular instance. 然后我会创建一些将提前安装在AMI上的服务,以允许我指定下载应用程序的URL以及我想要的特定实例的命令行参数。

Hope this helps. 希望这可以帮助。

Be carefull by default you can only spawn 20 instance by zone. 默认情况下,您只能按区域生成20个实例。 You need to ask amazon in order to use more instances. 你需要问亚马逊才能使用更多实例。

If you want low cost but don't care about delay you should use spot instances. 如果您想要低成本但不关心延迟,则应使用现场实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM