Alondradaisy / aws-s3-implementation-visual-guide

Amazon S3 Visual Guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Storing, Retrieving & Implementing Objects using AWS S3

This is intended to be a visual guide for one use case I implemented using Amazon S3. Essentially what this service offers is a simple cloud object storage that can read, retrieve, store and display data from anywhere, as well as import it into projects with a live 'Object URL'.

Object URL data Seattle Public Library image - stored data in bucket

You can think of S3 as a virtual cloud drive where you can create folders (buckets) to store data files (objects) and specify what kind of objects they are by adding tags (metadata).

For this use case, I built a simple e-commerce store and used Amazon S3 to create buckets and store objects in them. The data I uploaded into the bucket is referred to as an object and its metadata is a way to specify what kind of object it is. For my specific use case, I had to enable public access (which is by default blocked to the public), since the objects I stored are meant to be visible on the e-commerce application as product data. I also had to create a policy within my bucket using JSON syntax to grant resource-based public permissions to the bucket data.

Here we go: Storing, Retrieving & Implementing Objects using AWS S3

Assuming you have an AWS account, you will need to sign in as an IAM user.

If you do not yet have an account,click the link below to create one.

Once you have successfully created an account, the first location will be the AWS Managment Console where you'll see the range of services offered.

AWS Console

Navigate to S3 under AWS Services

Click on the Services icon in the top left corner or search S3 via the search bar

Create Bucket

Create Bucket

  • name the bucket

Select Region

  • select region
  • click 'Create Bucket'

Click 'Create Bucket'

Click 'Upload' to upload objects into the bucket

Upload files to bucket

  • click upload to add files to folder

Remember: folder = bucket | files = objects

Add/upload Files

  • local machine files will pop up
  • select a file to upload to the bucket
  • click on bucket name under 'Destination'
  • once the file is populated to said bucket, click 'Upload'

Click 'Upload'

Set Permissions

  • you should be at the base of the bucket in 'Objects' with the added file(s)
  • navigate to and click on 'Permissions'

Set Permissions

  • Click 'Edit' under 'Block Public Access'

  • Uncheck 'Block all public access' (AWS blocks public access by default)

Uncheck to unblock

  • then hit 'Save changes'
  • a confirm action text box will pop up, type in 'confirm' to unblock

Type in confirm

  • hit 'Confirm'
  • you have successfully enabled public access (remember, AWS by default blocks all public access to stored data, unless you edit the bucket policy to do so otherwise)

*You can decide if your specific use case does/doesn't need public access to the buckets.

Edit Bucket Policy

  • within 'Permissions' scroll down to 'Bucket Policy' and click "edit

Edit bucket policy

  • using JSON syntax, copy and paste the following
  • match the bucket name in "Resource" to your specific bucket name

Input value for key "Resouce" to your bucket name Keep in mind that my specific use case requires public access, so '*' makes it accessible to everyone. Again, you can decide if this is your case or not.

  • make certain that you add '"Principle": "*"' in the object
  • then hit 'Save Changes'

Successfully edited policy Notification that you have successfully permitted Public Access

Locate and implement Object URL(s)

  • navigate back to 'Objects'

Navigate back to Objects

  • Click on the object 'Name'
  • within 'Properties', locate 'Object URL'

Locate 'Object URL'

  • Click on the link and it will serve up the live URL that displays the object uploaded to the bucket

Object URL data Seattle Public Library - This is an object I stored in a bucket to demonstrate.

  • copy & paste the URL for development purposes

ET VOILA!

[Visual guide featured on AWS in Plain English] (https://medium.com/aws-in-plain-english/storing-retrieving-implementing-objects-using-aws-s3-e2b206e98623)