Home

How to Configure S3 Using a Desktop Application

|
|  Updated:  
2017-11-14 12:04:33
VMware vSphere For Dummies
Explore Book
Buy On Amazon
Even though many people consider the desktop dead, it still represents the most powerful and flexible method of interacting with AWS services. Using desktop applications also enable you to create environments in which local resources and cloud resources interact seamlessly under a level of control that isn’t possible using other approaches.

In addition, the desktop environment often provides the developer with access to unique resources and leverages a developer’s full grasp of various programming languages. With this in mind, find out how to create an application that interacts with S3 using a desktop application written using Python.

Installing boto

Python uses a library named boto to interact with AWS. As with all Python libraries, it’s easy to install if you have the pip utility installed. Anaconda comes with pip, so you shouldn’t have to do anything special to perform the installation. To install boto, open a command prompt or terminal window, type pip install boto3 (don’t type the comma), and press Enter. The installation should go quickly. After a few installation lines, you should see a success message. If you’re interested, you can read more about boto.

Listing S3 buckets

The process for getting the bucket list in Python is quite short. First, you need to access the boto library using this code:

from boto.s3.connection import S3Connection

Now that you have library access, create a connection to the library using this code:

conn = S3Connection('AccessKey', 'PrivateKey')

Make sure to provide your public access key as the first argument and your private access key as the second argument. The connection, conn, gives you access to all the S3 information. The following code retrieves a list of all your buckets and displays their names onscreen:

buckets = conn.get_all_buckets()

for bucket in buckets:

print(bucket.name)

About This Article

This article is from the book: 

About the book author:

John Paul Mueller is a freelance author and technical editor. He has writing in his blood, having produced 100 books and more than 600 articles to date. The topics range from networking to home security and from database management to heads-down programming. John has provided technical services to both Data Based Advisor and Coast Compute magazines.