The boto
documentation explains how to launch an Amazon EC2 instance in python, but I cannot find an explanation of how to run a python script on the instance once it is launched. Is this possible with boto? Ultimately, I would like to run python on an EC2 instance in a way that allows me to interact with the python interpreter like I do on my own machine with IDLE
and avoid having to paste code into PuTTY
, eg I use RStudio-server
for R
on EC2.
IDLE doesn't have any way to run script remotely (although it used to), but there are a number of other ways to do it:
An Amazon EC2 instance is simply a server, so you can access to the server via ssh. Check this document http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html
Once you manage to login into the instance, you can install RStudio following this guide http://inundata.org/2011/03/30/r-ec2-rstudio-server/
About IDLE, I'm not sure if you can execute IDLE from the ec2 instance.
If i understand you correctly you want to run a piece of code on ec2 which you are triggering from boto. you might want to have a look at this tutorial . The only thing different for you would be your ami which would need all the necessary installations to run your script. Once you trigger it from boto , it will run on an ec2 instance of they type you mention and then close itself once the work is done. If you need the instances just for small amount of time you might want to look into spot instances too. Hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.