Wednesday 25 June 2014

Getting started with AWS S3 - Part 1

Recently I was looking for a solution to a problem, the problem being the lack of on-premise storage. If we can't store it on-premise then maybe we can store it off-premise right? I started investigated some options and came across the AWS Storage Gateway (more about that in a future post) and while doing so I learned that Amazon Web Services has so much more to offer! I decided to set up my own personal account and make use of the AWS free tier. The free tier offers you access to a few services on a monthly basis for a 12 month period. You will need to have a valid credit card but will not be charged unless you exceed the free tier capacity.

In the first part of this series we will have a look at S3 Simple Storage Service. This will give you 5 GB of standard storage, 20,000 Get requests and 2,000 Put requests under the free tier. To get started you will need to login into your AWS account. Select S3 from the services in your console.
  • Click the blue create button
  • Enter a bucket name and select region. I chose the Sydney region as it is closest to my location.
    A region is made up of availability zones (AZ) which are basically datacenters within a region. These are interconnected by high speed links and provide redundancy for your stored data.
  • Click create and your bucket will be available
  • If you like things organized you can create folders. Click the create folder button and name your folder. Ensure you click the tick mark to save.
  • Now we need to upload some data. Go into your new folder and select upload from the actions menu.
  • Select a file on your workstation and upload to your bucket
  • Select your file and click the properties button on the far right

  • If you click the link under properties (next to padlock) you will get an access denied message. By default all objects are not publicly available. Right-click the object and select make public.

  • Try the link again and this time it will be accessible. Try for yourself :-)
We can also give permissions to an entire folder by making use of AWS policies. When you upload content afterwards the object should inherit the permission.
  • Select your bucket and go to properties. Under permissions section, click Add Bucket Policy.
  • The bucket policy editor will open. Select AWS Policy generator in lower left corner.
  • On the Policy Generator page you will need to enter following values:
    • Type of Policy: S3 Bucket Policy
    • Effect: Allow
    • Principal: *
    • Actions: GetObject
    • ARN: arn:aws:s3:::your-­‐bucket-­‐name/folder/*

       
  • Click Add Statement
  • The statement is added and you can now generate policy.
  • The policy is generated and you will need to copy contents to clipboard.


  • Go back to the bucket policy editor and paste the contents you previously generated. Hit the enter key if you find that Save button is greyed out.


  • Upload a new file to your folder and click its link under the object properties. You should be able to access the file in your browser. If not, double check for syntax mistakes in your policy

And with this my first blog post on AWS has come to an end. In part 2 we will talk about encryption, redundancy and archiving.

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete