Last update: 8/6/2012; 8:18:43 AM.

S3 for Poets

Intro permalink

S3 stands for Simple Storage Service.

It's a service provided by Amazon that provides storage and it's simple. If you look at it the right way. And it's Tuesday. And there's a full moon. :-)

Simple is in the eye of the beholder. And to a programmer, like me, S3 is simple. But we forget sometimes that what seems simple to us might not seem so simple to a literate person who isn't a programmer. For example, a poet.

But poets need to store stuff too, and Amazon provides a great service, so let's dive in and crash through the obstacles and get to the other side, where storage is simple.

Dave Winer, New York
August 2012

Requirements permalink

1. You must have a name like my.home.org you can use to point to your files.

2. You must have an Amazon account. S3 is not expensive, but it isn't free.

Slowly, methodically, carefully permalink

When you're setting up a server, which is what we're doing here, you have to do everything slowly, methodically, carefully. If you do it right, you should never have to do this again, it should just keep working. But sometimes you have to stare at the instructions and screen shots for clues of how to proceed. It's not like making a stew or walking to the supermarket, where there's room for creativity. There isn't much of that in setting up servers. The more carefully you do it, the quicker you'll be ready to do the fun stuff. I've learned this lesson myself, in over 30 years of using computers. I'm still learning it, because humans are so damned creative, and so easily distracted. :-)

What we're going to do permalink

This is what we're going to do in this tutorial:

1. Set up your Amazon account to access S3.

2. Create a bucket, a place to store stuff on S3.

3. Give it a name, a way to refer to it on the Internet.

4. Put some stuff in the bucket.

5. Verify that we are able to get to it on the Internet.

6. And optionally, if you're using EC2 for Poets, we'll to configure it to write into this bucket, so the feeds and rivers that it generates will be accessible to everyone.

Your Amazon account permalink

The Amazon account you use to buy socks and batteries is the same one you use to access S3.

Go to the S3 home page, and click on the Sign Up Now button. Do whatever it tells you to do.

Think of a name permalink

A name is something like static.scripting.com or myfiles.homepage.org. It has three parts, separated by dots.

Map the name to s3.amazonaws.com.

I can't show you how to do this because it depends on what domain name service you are using. Lots of people use GoDaddy, Gandi or Namecheap. I use Hover for most of my names. I know the people who run the place, and trust them, and the prices are good. They do not pay me to say this.

When you have the name, write it down on a piece of paper. It's important, and we'll use it in the next steps.

Create a bucket permalink

A bucket is very much like a folder on your hard disk. In fact, you gotta wonder why Amazon called them buckets. But that's what they called them, and so we will too. In this section we're going to create one.

1. Go to the S3 console on Amazon's website. The left panel is called Buckets, and underneath it is a button that says Create Bucket, and to its right is a drop down menu called Actions. Screen shot.

2. Click on Create Bucket. A dialog appears asking for the Bucket's name, and what region you want to put it in.

3. Enter the name you decided on in the previous section. Don't change the region choice. Click on the Create button at the bottom of the dialog.

The new bucket appears in the Buckets list, and the contents of the bucket (nothing) is displayed in the right panel.

Upload a file permalink

On your computer, create a file with a text editor. On the Mac, I use TextEdit. On Windows, you can use Notepad.

1. Add some text to the file. It can be Now is the time for all good men to come to the aid of their country. Or whatever you like. If you put bad words in there, it's certain that it will be cached by Google and read by a future employer and will ruin your life.

2. Save the file, calling it hello.txt. Here's what my file looks like.

3. In the S3 console, in the bucket you created in the previous step, click on the Upload button. A huge dialog appears. Click on the Add Files button. Choose the hello.txt file you created a minute ago.

4. At the bottom of the dialog, click the Start Upload button. When it's done you should see hello.txt in the contents panel of the bucket. You have now stored something in S3.

5. Click on the file, and choose Properties from the Actions drop-down at the top of the bucket display panel. A panel opens at the bottom of the window. Click on the Permissions tab. Click on Add more permissions, then the Grantee popup and choose Everyone. Check the Open/Download checkbox. And the Save button.

It's a good idea to pause a moment and reflect on that. You are powerful. And knowledgable. And a fast learner.

Find it on the Internet permalink

Now is the moment when it all comes together.

Take the name that you created in the third step, and add the name of the file, to produce a URL, like this:

http://demo.forpoets.org/hello.txt

The only difference between yours and mine is the name of the bucket.

Enter that URL in a web browser, and if it works, you should see the text you entered in your file in the browser window.

Why it works permalink

What we've done is glued together two parts of the Internet.

We made the name point to Amazon's server, s3.amazonaws.com. When Amazon receives a request for a file using that name as its domain, it looks to see if anyone has a bucket with that name. You do. It then looks into the bucket to see if there's a file with that name. There is.

Then Amazon checks to see if it's permitted to serve that file. We gave it permission to do that.

So Amazon found the bucket, and the file, and determined it was allowed to serve it. So it reads the file and returns it the person who asked for it. That's how the web works everywhere. We just made it work in a little corner of your Internet.

We glued two pieces together, but no one has to know that. To everyone else it seems as if you have a "web site."

The web is like that every where and in every way. It's all mirrors pointing at different things to create the illusion of something whole and well-organized. It's actually a chaos that's held together with glue exactly like the glue we just created. And that's why it works, and why it's so great and open. Because anyone can do this.

What you now know how to do permalink

S3 is a very good place to put backup copies of things you don't want to lose. It's inexpensive, and you only pay for what you use. It's also reliable, and if one of your documents proves to be very popular, you don't have to worry about Amazon being able to serve it because they are experts at making web content accessible because their business depends on it.

On the other hand, if you're posting politically sensitive material, you have to worry about whether Amazon will continue to host it for you. They cut off Wikileaks in 2010 when a US Senator complained to them. Not a good sign for the rest of us. However, I'm still using their service and recommend it to others, until we have something as reliable as Amazon S3 without the political risk. Another possibility is that Amazon could address the issue and make us all feel more confident in the reliability of their service.

Amazon S3 and OPML Server permalink

If you've run through the EC2 for Poets tutorial, at the end you're left with the OPML Server application running. It can be used to run several apps we provide that store stuff in S3. In the next few steps, I'll show you how to set up the OPML Server to connect up to the S3 bucket you created in the previous steps.

In the OPML application running on your server, choose the Preferences command from the Misc menu. A list of pages appears. Click on the one called Amazon S3. Screen shot. Fill in the two bits of information it asks for, following the instructions on the page. Press Submit. Then click on the Next link in the upper-right corner of the page.

You should now be on the Static files page. If the first checkbox is checked, you can leave it checked. That means that copies of all the files we create will also be saved on the server, in addition to S3. Then check the second box, indicating that you want to save files on Amazon S3.

Now enter the path to the bucket you created in the steps above. And for the URL, enter the same bucket name, only with http:/ in front of it. If you're confused, look at this screen shot and try to do what it does, substituting the name of your bucket in place of demo.forpoets.org.

Reference permalink

Wikipedia has a good technical explanation of names.

If you have questions, post them here or on the "Frontier-user mail list".

blog comments powered by Disqus

Last udpate: 8/6/2012; 8:18:43 AM.