Command line access to Cloud Services

September 8, 2010, by | Start Discussion

Now we have decided that everything in this issue will be discussed on cloud only. Although this individual article might not be that great for help but let's explore how we can use command line tools to upload our content on Amazon AWS and Google App Engine

Amazon EC2 & S3

S3cmd a command line tool for uploading, retrieving and managing data in Amazon S3. It is best suited for power users who don't fear command line. It is also ideal for scripts, automated backups triggered from cron, etc.

S3cmd is an open source project available under GNU Public License v2 (GPLv2) and is free for both commercial and private use. You will only have to pay Amazon for using their storage.

Though his is not the only tool but I prefer using the same for my activity and hence it would be easier for me to write the same. The HOWTO guide on the website is sufficient enough to understand and play around. Some excerpts are here.


svn co

Or simply go to


s3cmd --configure

You will be asked for the two keys – copy and paste them from your confirmation email or from your Amazon account page. Be careful when copying them! They are case sensitive and must be entered accurately or you'll keep getting errors about invalid signatures or similar.

There's an option to decide about use HTTPS or HTTP transport for communication with Amazon. HTTPS is an encrypted version of HTTP, protecting your data against eavesdroppers while they're in transit to and from Amazon S3

List all buckets.

s3cmd l

Make a bucket

s3cmd mb s3://my-bucket-name

List content of a bucket

s3cmd ls s3://my-mucket-name

Upload a file in a bucket

s3cmd put file.ext s3://my-bucket-name/file.ext

Retrieve a file from bucket

s3cmd get s3://my-bucket-name/file.ext file.ext

Delete a file from bucket

s3cmd del s3://my-bucket-name/file.ext

Remove a bucket

s3cmd rb s3://my-bucket-nam

Remember, a bucket will not be deleted unless it's empty

Google App Engine

Google App Engine supports the command line upload/update of content using python.

Creating a local site and configuration file:

Create a local folder on your machine to for this project. Put a folder inside that containing all your web pages. It can be called anything, but the AppEngine examples always call it static. For the sake of our article let's call it home

Say if your project folder is at C:MyWeb then this folder will be C:MyWebhome,and the main home page would probably be C:MyWebhomeindex.html.

So now you have a local folder on your machine @ C:MyWebhome which holds your application.

Now create a text file called app.yaml in the project folder (C:MyWebapp.yaml) with the following contents (I hope you know that you have to changethemysamplesite entry to the name you registered):

application: mysamplesite
version: 1
runtime: python 
api_version: 1
handlers: - url: (.*)/ 
- url: / 
static_dir: home

Creating the environment for upload:

The website and all related configuration is now ready for upload. Now you need to set up the environment for it. Don't worry I'll not ask you to do any coding, it's simple "next-> next" kind of installation

Uploading the website

Now it's the time to upload your static website. All you have to do is run the following command from command prompt. update C:MyWeb will come from Google App Engine SDK. This will ask you for your email address. Enter the one you used for creation of application. Next it will ask for your Gmail password, don't worry & type it too.

It will show some text and screen & BANG! your web application is up and running on Google AppEngine.
Now you can access your website by the url (changemysamplesite to your project name).

bio data - Rohit Srivastwa

Leave a Reply