AWS Simple Storage Services(s3). S3 buckets, mapping of S3 objects as network drive.
Tags: aws, s3, s3bucket, cloud
Published: 2022-07-06 05:31:06

**Amazon S3** 

- Simple Storage Service is a scalable, high-speed, low-cost web-based service designed for online backup and archiving of data and application programs. 

- We can use S3 to store and retrieve any amount of data at any time, from anywhere on the web. It allows to upload, store, and download any type of <u>files up to 5 GB in size</u>.

- This service allows the subscribers to access the same systems that Amazon uses to run its own web sites. The subscriber has control over the accessibility of data, i.e. privately/publicly
accessible.

- Since S3 is an object storage, it's not divided into multiparts or exists as a single storage.

-  When you modify a file in block storage, only the pieces that are changed are updated. When a file in object storage is modified, the entire object is updated.

- In object storage, each object consists of data, metadata, and a key.

- The data might be an image, video, text document, or any other type of file. Metadata contains information about what the data is, how it is used, the object size, and so on. An object’s key is its unique identifier.
![Metadata, key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u7oc9igaqot0pqqb4nt0.png)

**Provisioning before S3**

- It's important to keep backup of your data. But before s3 for backup of data, we used  to attach the servers to on premises SAN storage.

- For SAN storage, due to its hardware lifetime, we need to regularly change the on premises services or hardware disk drives, which was a costlier process. Thus AWS introduced S3 services.

- S3 buckets stores backup of your servers and it's very cheap. Such as for storing 1GB data costs you $0.01/month. But cost varies accordingly.

-  According to Aws SLA, for S3 bucket the data is 99.999999% available and durable. AWS makes three copies of data present in S3 bucket. One copy remains with the user while the other two copies are stored in other data centers. Hence you'll have high SLA.

**S3 Buckets**

- A bucket is a container for objects stored in Amazon S3. You can store any number of objects in a bucket and can have up to 100 buckets in your account.

- When you create a bucket, you enter a bucket name and choose the AWS Region where the bucket will reside. After you create a bucket, you cannot change the name of the bucket or its Region. 

- Bucket names must follow the bucket naming rules i.e, Bucket name should be unique and having small case letters only. You can also configure a bucket to use S3 Versioning or other storage management features.

- Each object has three main components; the object’s content, the object’s unique identifier, and the object’s metadata (including its name, size, URL).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/36t05giw7ogogye6rfm3.png)
 
- An Object cannot be independent, it must exist within a bucket. There can be hundreds of buckets in each Amazon account and within each bucket, there can be hundreds of objects. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vw361smfz232ugjb7pr.png)
 

**Bucket creation process:**

- Create a bucket, give a unique bucket name. If ACL is disabled, enable it. Untick "Block all public access".

- Leave other things as default and create.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c2vl192xs5iqbttfe75p.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tc8uaqsevl49bcvan3iv.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrp1kjlw1lrwpg63l1vb.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1ijjrr6w0or7j8yh3rd.png)

- Upload an Object in the bucket. Select a file from your local directory and upload it.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tf067j8e2chr7pqd8366.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7qdipfut7whet82atyg.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ejbs6reqasnjfj6psqdx.png)

**Mapping of S3 bucket object using TNT drive**

- In the bucket, click on object actions dropdown and select make public using ACL. So that the object will be publicly accessible.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o4fi48gp1vr3htsc1cmx.png)
 

- Now download TNT drive in order to mount S3 bucket in our local server. Now add account in TNT drive. 

- Go to IAM and create a user with S3 full access.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5xd2kz7h7oadqlhlopri.png)
 

- IAM user creation from AWS console.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6hqydx871bb0vxq9f0w.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/totwys01mq465x4vizj7.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5n3icrrcz6ocs37smfi.png)
   
- Now in TNT click add a account. Create account with access key and secret key ID for your IAM user created.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hepfubzlpi6npnt7rlvs.png)

- Now select "add a new mapped drive" in TNT drive. Browse for the S3 bucket you created and select your bucket. Click on add a new drive.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kmgbh6pqu9j78ietlx3d.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i2qqgv30wcl35gz5lruk.png)
  
- Go to my PC, find the mapped drive and see if the object is listed inside the bucket directory.( We can see that the object will be present inside the mapped drive).
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/45fpnxpffzskwnanlvus.png)

- Now add a text file in the local folder for your bucket and save  it. Now you can the same changes updated in AWS S3 console. That means in S3 bucket, you'll be having two objects.
Hence, we can also mount S3 objects as network drives also.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udx5fn0go5u7o2uyfh9r.png)
 ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4unp0i4lq95yrdzl6amf.png)
 
 
In the upcoming blogs we'll see how to host a static website using S3, S3 versioning and different storage classes of S3.
Stay tuned. :)

Thank You!!!