I want to host a website on a small AWS instance (e.g. t2.micro
) that launches a larger instance (e.g. m5.2xlarge
) whenever a user uploads data to be processed. I also want the larger instance to shut down when the processing is finished. Is there an AWS service or some other workaround that can do this? The larger instance would only be triggered every few days.
The easiest way to stop an instance when it has finished a task is to issue a shutdown
command to the Operating System. The default behaviour will be to Stop the EC2 instance.
The easiest way to start the instance is to call the StartInstances()
command, either via command-line or via an SDK. The tricky part is telling the instance what data should be processed. Also, consider what should happen if another data file is uploaded while the first file is being processed -- should it shutdown, or should it work on the new file?
I would recommend:
StartInstances()
to start the bigger instance