AlignMinds Technologies logo

My Experience Working with Amazon S3

MODIFIED ON: November 29, 2022 / ALIGNMINDS TECHNOLOGIES / 0 COMMENTS

What is Amazon S3?

The Amazon Simple Storage Service (Amazon S3) is a scalable, high-speed, low-cost Web-based service designed for online backup and archiving of data and application programs.

Amazon Simple Storage Service (Amazon S3) is simple storage for the Internet. You can configure it very simply and quickly in the AWS console. In S3, there’s no initial charges, zero set-up cost. You only pay for what you utilize. Unlimited storage, unlimited bandwidth, pay as you use and full control on file privacy are the most key features of S3. Amazon S3 also provides options to host static websites.

Why I find Amazon S3 great?

Most of the Websites are having Dynamic contents which are a collection of many Images, Videos and Audio, etc. These images will be either uploaded by the Users or the Admin of the website. Some websites will be having hundreds or even thousands of images depending on the Market they are focusing on. Storing the whole images inside Server will run out of the disk space and causes server issue. So, it will be good to save it directly in the Amazon S3.

How to Configure Amazon S3?

Amazon S3 is very simple to configure and use. This can be configured from the AWS console.

In S3 you can create Buckets. Buckets are very similar to Folders in our PC. It helps us to organize the files. S3 generates random URLs for each and every file uploaded to it. Each file is objects in S3. These objects can be accessed from the Web. S3 provides you with different policies and permissions to secure the contents stored in it.

Amazon Web Service (AWS) console provides you with the ability to create an IAM user. IAM user this the centralized user account provided by the AWS in order to access the AWS service remotely or through API calls, etc.

When we are using PHP code and if we wanted to access the objects from the S3, we need to use IAM user credentials to get the object from S3 bucket, if public access to the object is not allowed.

How S3 is used with a PHP web application?

As we have already mentioned that the S3 can be used for storing static contents like Pictures, Videos, Audio, etc. Let us see how it work in a real-life scenario.

Source (awsmedia.s3.amazonaws.com)

As the Image displays, when a user is trying to access a Webpage, the requests hit the Webserver. The Webserver sends a request to the Amazon S3 asking for an Image stored in it and the S3 returns the Image that is used in that particular Webpage.

How to set up Amazon S3?

Let us assume that we have a Web server running. We have a PHP site running in it with thousands of images as part of the content in it. We need to make sure there will be no storage issue due to running out of hard drive storage space.

Choose the following steps to mount S3 on an EC2 instance.

  • Create a new directory under that Webroot of the PHP Application where you wanted to mount the static contents.
  • Now you need to download and install s3fs from the source. S3fs is used to mount the S3 bucket to the system.
  • In-order to connect to the Amazon S3 bucket we need to authenticate. For that, we need to create a password inside the user home directory and pass the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY which we got from the AWS console.
  • Now, after mounting the Drive we can start using it as a local drive that is attached to the PC.

What are the PROS /CONS of using Amazon S3?

We understood Amazon S3 and its features, also how we can configure it. Now let us discuss the Advantage/Disadvantage of using S3, in the perspective of a web application.

PROS

  • S3 is that it can be mounted to an EC2 instance and can act as a local drive attached to a system.
  • S3 can be used as a Backup Volume where we can store the backups. This can save the EBS (Elastic Block Storage) space which is the main storage.
  • S3 can be used for many servers at the same time. Whereas EBS can only be attached to an instance at a time.
  • Highly Available, Redundant. Basically, data loss is not possible (99.999999999% durability, 99.9 uptime SLA).
  • S3 storage provides up to 5TB storage space.

CONS

  • S3 is an object store it is not a file system.
  • Hence S3 is not a file system it does not have file-system permissions.
  • S3 is slower than the EBS volume which is directly connected to the instance. Hence it is good to store static contents like Photos, Videos, etc.

Conclusion

Amazon S3 is the best way to Host web sites cost-effectively. Since the price of physical drives is huge, Amazon S3 will be a good option to store static content.

– Ravi Kiran Varma

Leave a reply

Your email address will not be published.

0 0 votes
Article Rating
guest
0 Comments
Inline Feedbacks
View all comments