Archive for Tag ‘boto‘

Controlling an EC2 instance with python

One of the selling points of EC2 is that it enables elastic provisioning of computing infrastructure; this allows following novel usage patterns where a server is used only for the time required to do some work.

The key to reach this flexibility is the API that gives developers the ability to startup a server, configure it, use it and shut it down. There are libraries for many programming languages but I like the way the boto python library makes it really simple do these things (and a lot more).

Here I’ll show how to use boto to start a server instance then how to send a file to the instance and execute a command on the remote server, and finally I’ll show how to terminate the instance.

Den Rest lesen…

Backup to S3

Here is a small script I’m using to backup files to S3. Actually it implements all the basic operations you need for S3 (bucket creation, listing, file upload and download).

It’s rather trivial but I was able to keep it so simple, thanks to it’s use of the Boto python library to do all of the AWS heavywork. Anyhow I think it may be useful.

A few examples:

Here is the code:

Den Rest lesen…