Thursday, 15 June 2023

Amazon S3 – Cross Region Replication

 The AWS S3 – Cross-region replication (CRR) allows you to replicate or copy your data in two different regions. But why do you need to set up CRR? There are many possible scenarios where setting up cross-region replication will prove helpful. Some of them are enlisted below:

  1. Improving latency and enhancing availability: If you are running a big organization with customers all around the world then making objects available to them with low latency is of great importance. By setting up cross-region replication you can enable your customers to get objects from S3 buckets which are nearest to their geographic location.
  2. Disaster recovery: Having your data in more than one region will help you prepare and handle data loss due to some unprecedented circumstances.
  3. To meet compliance requirements: Sometimes just to meet compliance requirements you will need to have a copy of your data in more than one region and cross-region replication can help you achieve that.
  4. Owner override: With AWS S3 object replication in place you can maintain the same copy of data under different ownership. You can change the ownership to the owner of the AWS destination bucket even if the source bucket is owned by someone else.

Setting up CRR:

Follow the below steps to set up the CRR:

  • Go to the AWS s3 console and create two buckets.
  • Let’s name our source bucket as source190 and keep it in the Asia Pacific (Mumbai) ap-south 1 region. Do not forget to enable versioning. Also, note that the S3 bucket name needs to be globally unique and hence try adding random numbers after bucket name.

Source bucket: source190

  • Now following the same steps create a destination bucket: destination190 with versioning enabled but choose a different region this time.  

  • Now click on your source bucket and head over to the management tab:

  • Now, click on “Create a replication rule” and give your replication rule a name as “ replicate190”  

  • Choose the destination bucket as “destination190”. 

Set destination bucket

Notice that you have an option to choose a destination bucket in another account. 

  • In order to replicate objects from the source bucket to the destination bucket, you need to create an IAM role. So just create one by clicking on “create a new role”.  

Create IAM role

  • If you want your S3 objects to be replicated within 15 minutes you need to check the “Replication Time Control (RTC) box. But you will be charged for this. So we will move forward without enabling that for now and click on save.  

As soon as you click on save, a screen will pop up asking if you want to replicate existing objects in the S3 bucket. But that will incur charges so we will proceed without replicating existing objects and click on submit.  

  • After completing this setup you can see a screen saying “Replication configuration successfully updated”. 

It’s time to test! Now go to the source bucket: source190 and upload a file.  

Now head over to our destination bucket: destination190 to check if the uploaded file is replicated to our destination bucket. You can see that our uploaded file is successfully copied to the destination bucket:

Note: Do not forget to empty your buckets and then delete them, if you do not have any further use. Also, you cannot delete a bucket if it is not empty.  

Some important points about CRR:

For cross-region replication you must have:

  • Source bucket and destination bucket in different regions (for the same region you can use the same region replication or SRR).
  • Versioning is enabled in both the source as well as destination bucket.

When objects are replicated to a different region then:

  • Object metadata, Access control list (ACL), and object tags are also replicated.
  • The objects which were already present in the source bucket before setting up replication will not be replicated or copied to the destination bucket by default but you can perform a one-time batch operations job but that will incur additional charges.
  • If your source bucket is acting as a destination bucket for another bucket or there are objects replicated in the source bucket from another bucket, then those objects will not be replicated to the destination bucket.

You can also enable bi-directional CRR by making the source bucket also the destination bucket for the destination bucket and vice versa.  

Lastly, it is not necessary to have a destination bucket in the same account. AWS Cross-Region Replication can also be implemented in cross accounts ( given that the owner of the source bucket have the permission to copy data in the destination bucket)  

Amazon S3 – Lifecycle Management

 An S3 Lifecycle Management in simple terms when in an S3 bucket some data is stored for a longer time in standard storage even when not needed. The need to shift this old data to cheaper storage or delete it after a span of time gives rise to life cycle management.

Why is it needed?

Assume a lot of data is updated in an S3 bucket regularly, and if all the data is maintained by standard storage it will cost you more(even if previous data is of no use after some time). So, to avoid extra expenses and to maintain data as per requirement only life cycle management is needed. 

There are 2 types of actions:

  1.  Transition actions: Moving objects from one storage class to another storage class. Each storage class has a different cost associated with it.
  2.  Expiration actions: When objects expire after a span of time (say 30 days,60 days, etc). Amazon S3 deletes expired objects on your behalf. 

Implementation:

Follow the below steps to implement the S3 life cycle management:

Step 1: Login to your AWS,  and go to services then under to S3.

Step 2: Create a bucket, since applied to the bucket and not on a specific object or full storage.

  • Give bucket name(Try to give it a unique name else it will give an error later), uncheck the Block all public access. option.

  • Then check the “I acknowledge …” checkbox and click on CREATE BUCKET.

Step 3: Upload data into the bucket. 

update following permission, click on next, and upload 

Step 4: Go back to your bucket, and go to “Management”

  • Click on “Get Started”.

  • Give life cycle name(need not be unique) and update settings.

  • Add transitions(i.e. transferring data from standard storage to ones that cost less after a span of  when data is no more useful. )

  • Do expiration settings (days after which data needs to be cleared from storage) and Save.

Step 5: Finally, an S3 bucket with LIFE CYCLE MANAGEMENT is created and will apply to all the data uploaded in the future.

Difference between Amazon S3 and SecureSafe

 1. Amazon S3 : 

Amazon S3 stands for Amazon Simple Storage Service. It is a cloud storage service that is provided by Amazon Web Services. It provides object storage through a web service interface. It allows us to store any type of objects like data lakes for analytics, data archives, backup and recovery, disaster recovery, hybrid cloud storage and internet applications. It was launched by AWS in 2006. 

2. SecureSafe : 
SecureSafe is a file hosting service and cloud storage which is provided by DSwiss AG. It provides password safe, a document storage and digital spaces for online collaboration. It was developed on the basis of principles of security by design and privacy by design. It was launched by DSwiss AG in 2009. It offers 100 MB free storage space. It offers limited storage space for paid upto 100 GB. 

Difference between Amazon S3 and SecureSafe :

S.NOAMAZON S3SECURESAFE
1It is owned by Amazon.It is owned by DSwiss AG.
2It was launched in 2006.It was launched in 2009.
3It was launched by Amazon Web Services (AWS).It was developed by DSwiss AG.
4It offers 5 GB of free storage space.It offers Password manager for 50 passwords and 100MB file storage in Free plan, 1GB file storage with Password manager for unlimited passwords in Pro plan, 20GB file storage with Password manager for unlimited passwords in Silver plan, 100GB file storage with Password manager for unlimited passwords in Gold plan.
5It provides unlimited storage space for paid.It provides limited storage space for paid.
6It requires credit-card details for free trial.It does not require credit-card details for free trial.
7It has the unlimited maximum storage size.Maximum storage size is 100 GB here.
8It does not offer data inheritance.It offers data inheritance.
9It supports file versioning.It does not support file versioning.
10It has Amazon S3 limit as traffic or bandwidth limit.It has no traffic or bandwidth limit.
11Maximum file size is 5 TB here.Here maximum file size is 2 GB.

Difference between Amazon S3 and TitanFile

 1. Amazon S3 : 

Amazon S3 stands for Amazon Simple Storage Service. It is a cloud storage service which is provided by Amazon Web Services. It provides object storage through a web service interface. It allows to store any type of objects like data lakes for analytics, data archives, backup and recovery, disaster recovery, hybrid cloud storage and internet applications. It was launched by AWS in 2006. 

2. TitanFile : 
TitanFile is a file sharing service and cloud storage service which is provided by TitanFile Incorporation. It is one of the secure cloud computing services available. It is majorly used in Canada and United States. It provides a secure way for professionals to share files and communicate with their clients. It was launched by TitanFile Incorporation in 2011. It does not offer free storage space. 
 

Difference between Amazon S3 and TitanFile :

AMAZON S3TITANFILE
It is owned by Amazon.It is owned by TitanFile Incorporation.
It was launched in 2006.It was launched in 2011.
It was developed by Amazon Web Services (AWS).It was developed by TitanFile Inc.
It offers 5 GB of free storage space.It does not offer free storage space.
It provides unlimited maximum storage space for paid.It also provides unlimited maximum storage space for paid.
It is used across the world.While it is majorly used in Canada and United States.
It provides 5 GB for 12 month free trial.It provides 15 days free trial.
It has the unlimited maximum storage size.Maximum storage size is unlimited here also.
It requires credit-card details for free trial.It does not require credit-card details.
It has Amazon S3 limit as traffic or band-width limit.It has no traffic or band-width limit.
Maximum file size is 5 TB here.Here maximum file size is 5GB for Individual and Starter, 50GB for pro and 50+GB for Enterprise paid plan.

Difference between Amazon S3 and Box

 1. Amazon S3 : 

Amazon S3 stands for Amazon Simple Storage Service. It is a cloud storage service which is provided by Amazon Web Services. It provides object storage through a web service interface. It allows to store any type of objects like data lakes for analytics, data archives, backup and recovery, disaster recovery, hybrid cloud storage and internet applications. It was launched by AWS in 2006. 

2. Box : 
Box is a cloud storage and file hosting service provided by Box Incorporation. It was developed by Aaron Levie and Dylan Smith. It is basically a cloud content management and file sharing service for business. It offers 10 GB storage space. It was launched by Box Incorporation in 2005. It is available for Windows, macOS and other platforms. 

Difference between Amazon S3 and Box :

Amazon S3BOX
It is owned by Amazon.It is owned by Box Incorporation.
It was launched in 2006.It was launched in 2005.
It was developed by Amazon Web Services (AWS).It was developed by Aaron Levie and Dylan Smith.
It offers 5 GB free storage space.It offers 10 GB free storage space.
It has the unlimited maximum storage size.Maximum storage size is 100 GB for personal accounts and unlimited for business accounts.
It supports file versioning.It supports file versioning in premium accounts only
It does not support remote uploading.It supports remote uploading of 30 MB per file via IFTTT.
Maximum file size in Amazon S3 is 5 TB.Here maximum file is 250 MB for free, 150 GB for paid.
It requires credit-card details for free trial.It does not require credit-card detail for free services.

Amazon S3 – Creating a S3 Bucket

 Amazon Simple Storage Service (Amazon S3) or Amazon S3 is an object type, high-speed or with minimal latency, low-cost and scalable storage service provided by AWS. S3 also allows you to store as many objects as you’d like with an individual object size limit of five terabytes. It provides 99.999999999 (11 ‘9’s) percent durability and 99.99 percent availability of the objects which reside in it. In this article, you will create your first bucket in Amazon S3.

Follow these steps to create a bucket in your Amazon Simple Storage Service:

Step 1: Log on to your AWS Console. If you don’t have an account, you can create it absolutely free as Amazon provides a 1-year free tier to its new users.

Step 2: In the search bar located at the top of your AWS Management Console, type “Amazon S3”. You will see something like this:

Step 3: Click on “S3 – Scalable Storage in the Cloud” and proceed further.

Step 4: Click on “Create Bucket”. A new pane will open up, where you have to enter the details and configure your bucket.

In the general configuration category:

Step 5: Enter the name of your bucket (We are giving geeksforgeeks-bucket in our case). The following are some rules for naming a bucket in Amazon S3:

  • A bucket name should be unique across all Amazon S3 buckets.
  • Bucket names must be between 3 and 63 characters long.
  • Bucket names can consist only of lowercase letters, numbers, dots (.), and hyphens (-).
  • You cannot write a bucket name as an IP Address like 192.168.0.1.
  • Bucket names must begin and end with a letter or number.
  • Bucket names should not contain two adjacent dots (.).
  • Bucket names should not end with -s3alias.
  • Bucket names should not start with xn--.

Step 6: Next, choose an AWS region nearest to your location or where you want your data to reside. In our case, it is [Asia Pacific (Mumbai) ap-south-1].

Our configuration looks like this:

In the Object Ownership category, leave it as recommended. We use it for controlling the access of the files by specifying roles. If ACLs are disabled, the bucket owner automatically owns and has full control over every object in the bucket.

In Block Public Access settings for this bucket category, ensure that BLOCK ALL PUBLIC ACCESS has been checked. If you want to host your static website in this bucket, you can change the settings later.

In the Bucket Versioning category, choose Disabled. Bucket versioning is helpful when you want to track any changes in the file made, intentionally or unintentionally. You can see the previous versions of a file, retrieve it, restore it or preserve it.

Leave other advance settings as default.

Step 7: Click on Create Bucket.

If the bucket is created successfully, you will see a message like this on the top of the page:

Congratulations! You have successfully created your first bucket in Amazon Simple Storage Service (S3).

Amazon Simple Storage Service(S3) – Versioning

 Amazon Simple storage service (S3) it is an object oriented storage service which provides the features such as data availability data scalability, security, and also used for enhance the performance. S3 also allows you to store as many objects as you’d like with an individual object size limit of five terabytes. With cost-effective storage classes and easy-to-use management features, you can optimize costs, organize data, and configure fine-tuned access controls to meet specific business, organizational, and compliance requirements.

An organization relies on services that give them security, reliability, performance, and data availability. AWS provides an S3 feature which is basically a storage class that gives all such features and also promotes scalability of the organization as well as stores data and protects them.  Now let’s understand what is S3 Versioning, in layman’s term suppose in the S3 storage class, someone uploads a picture of ID:113, and suppose after some time he/she updates the picture or replace it with ID:112. Now, suppose that he/she feels that the previous one was better and wants to roll back to picture ID:113. How to get that? The S3 Versioning comes into the picture now.

Pictorial representation of S3-Versioning

It allows storing of different versions or forms of the object. Versioning makes it easier to preserve and roll back old updates of objects, whenever needed. Moreover, it helps to restore back the object from any unintended user activity such as deleting the object unintentionally. 

Implementation:

Let’s demonstrate it with step by step procedure:

Step 1: Log in to your Amazon Web Services Account>> In your console search bar, search “S3”>>then select the S3.

Step 2: Then on the Amazon S3 page click on create a bucket.

Step 3: In create bucket page, Give the bucket a Name

NOTE: name must be unique and should not contain any space or uppercase letter)>>Select any region>>Enable ACL (Access Control List basically helps to manage access to created buckets and it’s a different version of object)>>Un-tick Block all public access option (If you want to give it public access)>>Click on “I acknowledge” >> Enable Bucket Versioning>>Keep default encryption disabled>>Click on Create Bucket

Step 4: Click on your created bucket>>Click on upload>>Upload any file

Step 5: Here I have uploaded a txt file named Text1 (Content of Text1-“This is my text1”)>>Click on the file you uploaded>>Below you will find object URL>>try to hit the link in a browser, you won’t be able to access the content. Now, go to object action>>Click on the public using ACL.

Step 6: In make public page>>Click on Make Public option.

Step 7: Again, click on your uploaded file>>now copy on the object URL present below>>Try to hit on your browser.

After hitting the URL in the browser:

Step 8:  Now, go to your bucket where your file is present, make some changes, and upload it again. My updated file content is “This is my updated text1”. Then follow Steps 5,6,7 again. This time you can see your updated version of the file.

Step 9: Now to get the previous content of the file or to roll back-Go to your created bucket>>Click on show version option>>You can find all your previous contents.

Step 10: To get your deleted content- Go to your bucket>>select the file>>click on delete option present on top>>Type delete in delete screen.

Step 11: Go back to the same bucket>>Click on show version  

You can find your deleted file with type as “Delete marker”. To recover the deleted object, delete the “Delete marker”.

This rollback of versions of objects is what makes versioning popular.

In above we created bucket with versioning enabled 

Steps To Create S3 bucket with versioning Disabled

STEP 1: Create or login to your AWS account and then you will land on AWS management console and Go to services and select S3.

 

STEP 3: click on create bucket and A new window will pope up, where you have to enter the details and configure your bucket

 

 

STEP 4: Configure public access settings for your bucket.

 

STEP 5: Configure Bucket Versioning (let it be disabled as of now) and add Tags to your bucket.

Versioning in AWS is used to store the “multiple variant of object ” inside the same bucket 

 

STEP 6: Click on Create bucket 

 

So we have created bucket with Versioning off in this part.