What is AWS S3 and How Does It Work?
Tags: aws, s3, devops, cloud
Published: 2023-05-26 14:28:45

## Introduction

AWS (Amazon Web Services) provides businesses with a powerful and scalable infrastructure through various cloud-based services. One of these services is Amazon S3 (Simple Storage Service), a storage service that offers reliable, scalable, and high-performance data storage. In this article, we will delve deep into what AWS S3 is, how it works, and the advantages it offers.


![S3 AWS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zifoi81wmj4otns9fddh.jpg)


1. **What is AWS S3?**

- Amazon S3 is a cloud-based storage service used for data storage. S3 allows customers to store, backup, and retrieve data easily and cost-effectively. Data is stored on secure servers provided by AWS, without the need for a dedicated database or server. AWS S3 can be seamlessly integrated into applications, simplifying data management.

2.**Advantages of AWS S3**

- High Durability: AWS S3 provides a system where data is backed up in multiple locations, ensuring uninterrupted access even in the event of a single point of failure.

- Scalability: AWS S3 allows you to quickly expand storage capacity based on your needs. Capacity expansion or reduction can be easily performed.

- High Performance: AWS S3 has the capability to store and retrieve large amounts of data quickly. Data can be accessed instantly without any delays.

- Security: AWS S3 offers various security measures to keep your data secure. Data is encrypted by default and provides protection against unauthorized access.

- Cost-effectiveness: AWS S3 allows you to pay only for the storage space you actually use, helping you avoid unnecessary costs.

3.**Use Cases for AWS S3**

- Data Backup and Archiving: AWS S3 is an ideal choice for backing up important data and long-term storage.

- Website Hosting: S3 can be used to host static websites, providing a simple and cost-effective solution.

- Big Data Storage and Analysis: AWS S3 is well-suited for storing and analyzing large volumes of data, making it a popular choice for data lakes.

- Media Distribution: S3 allows storage of media files, enabling fast and seamless content delivery to end-users.


**Let's create a bucket**

If you have an existing amazon web service account, you can go to it by clicking the relevant link [here](https://s3.console.aws.amazon.com/s3/).

If you do not have an Amazon Web Service account, we can register by clicking the relevant link [here](https://aws.amazon.com/)

When we arrive on the Amazon S3 page, a welcome screen will welcome us. There is some information about S3 here, you can take a look if you want.

![Amazon S3 homepage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/35hnsy7vs1bkmp6rcq2p.png)

We create s3 buckets for ourselves by clicking the create bucket button.


![Create bucket](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dq0o1onpjesh2r7u0977.png)

1. First, we set the Bucket name.

2. We set AWS Region for S3.

**What is Object Ownership**

Amazon S3 buckets have the ability to be set up so that no matter which Amazon AWS account is used to upload objects to it, the bucket can enforce that ACLs are disabled and the uploaded objects are always owned by the AWS account that owns the bucket.

ACLs Disabled (Recommended) - ACLs Enabled:
In AWS S3, there are two different methods to control access to objects: Access Control Lists (ACLs) and Identity and Access Management (IAM) policies.

**ACLs Disabled (Recommended):**

- In this mode, ACLs are disabled for S3 objects, and access control is managed through IAM policies.
- IAM policies are used to assign access permissions to specific IAM users or IAM groups.
- This mode is preferred to centrally manage access controls and provides better security and manageability.

**ACLs Enabled:**

- In this mode, ACLs are enabled for S3 objects, and access control is managed using both ACLs and IAM policies.
- ACLs are used to apply specific access permissions to individual users or user groups.
- This mode can be used to provide more flexibility in access control alongside IAM policies. However, managing ACLs can become more complex and require additional attention for security and auditability.


![Public Access](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5cmwj0c3zuznf9pnf8of.png)

Block Public Access Settings increase data security by preventing S3 buckets from accidentally becoming public. These settings are an important security measure to prevent users from unintentionally making data public.



![Bucket Versioning](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nqc872hmavciztoqou9z.png)

When bucket versioning is enabled, different versions are saved for each object. Every change made to an object is saved as a new version and previous versions are also kept. In this way, each change stage of the objects can be tracked and undone.


![Default encryption](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3kg1qsgio67n1p10xj1c.png)

When Default Encryption is enabled, every new object uploaded to the S3 bucket is automatically encrypted. Encryption is used to ensure the confidentiality and security of data. The encryption process is performed on the server side where the data is stored, and the data is encrypted and stored.

We have completed our Bucket creation Let's create a Bucket by clicking the Create bucket button.


![Buckets Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbhth3zn7lcw9kmedzns.png)

1. Properties: Bucket version, Bucket overview, we can edit the encryption properties here.
2. Permissions: Required settings for Block public access, Bucket policy, Object Ownership, Access control list 
3. Metrics: Bucket metrics, Explore metrics for usage, request, and data transfer activity within your bucket.
4. Management: Lifecycle rules, Replication rules, Inventory configurations
5. Access Points: An Access Point alias provides the same functionality as an Access Point ARN and can be substituted for use anywhere an S3 bucket name is normally used for data access.

In general, we have mastered the interface, let's do a file upload process to try.


![Objects Upload](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3m5deqdnyrcjm3poc1l.png)

⛔ Small Note: Add the files and folders you want to upload to S3. To upload a file larger than 160GB, use the AWS CLI, AWS SDK or Amazon S3 REST API.


![Files and folders](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8kdsq03hnrzd96gm04so.png)

Our space for uploading Folders and Files


![Storage class](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgyn6a0zr4r2sd11s0g3.png)

Amazon S3 offers a range of storage classes designed for different use cases.


![Upload Status](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hw107wmlvsqbbr2xtvyd.png)

We have successfully uploaded our file, let's check it out


![Image Open](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qz7leos6pxcbudt5msw.png)



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


We learned about S3 in general and learned how to store it.
If you are a web developer, you can host the backup of your site on s3 with the s3 script I shared on github. [Link](https://github.com/alperen-cpu/PHP-S3-Backup)