I want to help beginner gain some confident on their journey in cloud and tech. I will be posting tutorials and lessons on cloud tech and security such that its more understandable and have not burden but fun and easy to comprehend. Let’s start with a service provided by AWS, called Amazon S3.
You ever heard about S3? No! Ever used Google Drive to store your files online? Yes! It’s a primary example of how object storage works.
There are tons of ways to store a file in a cloud system. Object storage is one of that way. Don’t panic if you don’t understand what an “Object Storage” is. It’s just a techy way of saying that the file will be treated as a distinct unit, that’s all you need to know for now.
Okay, so it stores files distinctly. Good. Now you need to know about what a bucket is. What bucket? Don’t push your nerves. Think it of as a container where you store your file. It makes the file more manageable.
Features:
- Of course, you can save file in it. Duh. But it’s very fast. In tech world, it has a low latency and high throughput. (Be familiar with these terms, open the dictionary)
- Its available up to 99.999999999% of the time in a whole year. Mean, it durable.
- Security, you can use policies to manage the access to the files.
- Host a static web content through AWS S3. ……….and there any many more features, you will know when you work with it a bit. Let’s jump to a simple tutorial.
Overview:
- This is what we are going to do. Create a bucket, upload some files in it, and the files public to share with others. Break it down, make it simple.
Creating bucket in AWS:
- Go to https://aws.amazon.com/ sign up if you have never had an account. Explore but don’t go too deep into various services, it kind of feels overwhelming. Search and select S3 services on the panel.
- Select Create bucket and you’ll see a portal to configure your bucket. Make sure you have a unique name for your bucket.
- Let any other configuration be as it is. Scroll to the end of the page. Select Create Bucket. You’ll see the following page.
Let’s upload files inside your newly created bucket.
Select your newly created bucket and see following page. This is where you can configure everything related to your bucket.
- Select Upload and now you can see different options to Add files and Add Folder. For now, we’ll just add a single file.
- Select your file and upload. I uploaded a file name “friendly-cloud-rat.jpg”.
- Upload succeeded.
- You will be able to list all your file inside your bucket. Select the file and “Copy URL” of the file. This URL redirects you to your file inside S3 bucket. Extra stuff: AWS Route53 maps S3 object with a URL
- Open another tab and enter your URL.
- DAMMMMMMMMMnnnnnnnnnnnnn. Why is it not working? If you are really reading this, comment your thoughts on why didn’t this work? This is just a checkpoint to make sure you are devoted to this tutorial, not just skimming and making yourself feel that you know stuff. I used to do that, that’s not good. “Apply yourself” that’s what I am doing. *a lil pep talk
- By default, AWS S3 bucket “Block all public access” is turned on. Go to Permissions in your bucket configuration.
- Select edit. Read this all if you want, but no worries take it easy.
- Turn it all off. Select Save Changes
- Confirm bro.
- TRY AGAIN. Copy Object URL. Go to the link.
- ughhhhhhhhhhhhhhh. Don’t worry. It’s a security stuff, S3 is actually public. However, to access the files inside it, an explicit policy needs to be implemented.
- Go to Permissions tab for your bucket. Scroll down to Bucket Policy and select Edit.
- It might get boring here, but this is what it takes to build better stuff.
For now just copy the JSON policy and paste it. Don’t burden too much on any stuff, continue tomorrow if its too much. Take it EASSyyy.
- Paste the below policy to bucket policy and save it.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::myunique-aws-s3-bucket/*" } ] }
- See something different. Copy the object URL and try again.
- We made it. NOICEEEEEE
If you read it till here, thank you and thank yourself for your dedication. If you didn’t understand this, comeback tomorrow and read it again. Comment any questions, there are a lot of student and people even professional who are afraid and nervous about asking question. Don’t worry about anybody else, just comment. Public comments will encourage others to normalize asking question. I’ll be happy to help. Peace.