A very rough and ready script for starting, SSH-ing to and stopping an AWS instance.
I use AWS for remote development in RStudio and VSCode and got bored of starting and stopping instances through the AWS console, copying DNS names etc. This script wraps some boto3 functions.
- Make sure the script is executable and somewhere on your
$PATH
- Either
- Set an environemnt variable called
$AWS_INSTANCE_ID
and runstart-aws-instance
, or - Run
start-aws-instance <instance-id>
- Set an environemnt variable called
- Once the instance is up and running, the URL for RStudio will be displayed (
http://[something].amazon.com/8787
) - The script gives you the option of
ssh
-ing into the instance - Once you exit the
ssh
command, either by callingexit
from the remote server or answeringno
to the prompt, you will be asked whether you want to shut down the instance