'Does AWS EC2 allows for a process of scheduled instance start -> run scheduled code -> instance close repeatedly?

I have some code I have to manually run daily. I would like to automate this and felt EC2 would be the best option.

What I'm not clear on is whether or not I can do this while I am away without having the Remote Desktop up.

Namely, if I'm away from my host machine for multiple days, would AWS allow for the following implementation?:

  1. Instance starts on a schedule

  2. Within the instance a set of code is run based on a schedule

  3. Instance stops on a schedule

I know I can start and stop instances on a schedule as I've done that. What I don't know is if, within those automatically started instances, I can have code automatically run.

Thanks in advance and please let me know if you need any additional info.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source