Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

amazon web services - Launch EC2 instance on S3 upload + process file

I want to automatically launch an EC2 instance whenever a user uploads data to my datadump-input S3 bucket. The EC2 instance should then:

  1. Start
  2. Download the file from datadump-input and process it with pre-loaded Python scripts
  3. Stop

What's the easiest way to do this? Specifically, how do I get the file from the S3 bucket to the EC2 instance? The filename will be different on each upload.

I was thinking Lambda but am open to other services.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I would have S3 send the new object notification to an SQS queue. Configure an auto-scaling group to launch an EC2 instance when the queue depth is greater than 0. On the EC2 instance, have your application poll the SQS queue for messages until there are no more.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...