I have started playing around with AWS (privately). I have one free tier Amazon Linux 2 VM running right now, which serves a "fat" service (in a docker container) to myself and one other person. It has an Elastic IP associated with it.
We use the service 1-2 hours every few days.
Is there, in the rather large AWS zoo of services, a smart way to have the VM shut down when not in use, and come up when we need it? "Need it" could be measured by counting network traffic, i.e. I could in principle write a little script which uses tcpdump
or something like that to watch for 15 minutes of no traffic on the port of the service and then somehow trigger a shutdown; but how would we get it up again?
I am happy to change it in any way necessary; but the Docker image has to be considered a black box for all intents and purposes. There is one docker volume (realised as a directory in the home of the ec2-user
right now) if that makes a difference. Timing is not critical.
So far I'm doing shutdowns/startups through the EC2 Management Console, but would like to end that.