AWS Storage Comparison: EBS vs S3 vs EFS vs FSx
Tags: aws, beginners, tutorial
Published: 2023-07-09 03:25:49


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tnzuwcleimlormthxrut.jpg)
## Introduction
In this tutorial, we are going to understand the common types of storage options on AWS, which include Simple Storage Service (S3), Elastic Block Store (EBS), Elastic File System (EFS), and Amazon FSx.

Firstly, when we deploy EC2, we need a disk storage for storing the EC2 Operating system file and temp cache file to be able to start running the EC2 instance and we can call this type of disk as a OS Disk. Depending on user practice, we can expend the OS disk size or attach the additional disks for more disk storage. 

While the file in the disk storage can be accessed by the attached EC2, it may be inconvenient for other EC2 to access. In this case, we may prefer to use S3 bucket or Elastic File System (EFS) for better file sharing purpose.

For the Elastic File System (EFS), it will support cross-VPC EC2 or single VPC EC2 file drive mounting as Network Attached Storage (NAS). For the cross-VPC mounting, it requires the VPC peering. 

In some case, using S3 as file sharing can be less troublesome. However, EFS outpreform S3 in term of file access speed and user firendliness.

Since Elastic File System (EFS) only support Linux-based file system, if we want to mount the NAS to Windows-based EC2, we need to use Amazon FSx for Windows File Server.


## Simple Storage Service (S3)


During the creation of S3 bucket, you are only required to select the region to deploy the bucket
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h9b6kjyib400wb9m7a7e.png)

When you upload the file to S3, you can determine which storage class the file belongs to.

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

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

| Storage class                                 | Designed for                                                                                                           | Availability Zones | Min storage duration | Min billable object size | Monitoring and auto-tiering fees            | Retrieval fees    |
| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------ | -------------------- | ------------------------ | ------------------------------------------- | ----------------- |
| Standard                                      | Frequently accessed data (more than once a month) with milliseconds access                                             | ≥ 3                | \-                   | \-                       | \-                                          | \-                |
| Intelligent-Tiering                           | Data with changing or unknown access patterns                                                                          | ≥ 3                | \-                   | \-                       | Per-object fees apply for objects >= 128 KB | \-                |
| Standard-IA                                   | Infrequently accessed data (once a month) with milliseconds access                                                     | ≥ 3                | 30 days              | 128 KB                   | \-                                          | Per-GB fees apply |
| One Zone-IA                                   | Recreatable, infrequently accessed data (once a month) stored in a single Availability Zone with milliseconds access   | 1                  | 30 days              | 128 KB                   | \-                                          | Per-GB fees apply |
| Glacier Instant Retrieval                     | Long-lived archive data accessed once a quarter with instant retrieval in milliseconds                                 | ≥ 3                | 90 days              | 128 KB                   | \-                                          | Per-GB fees apply |
| Glacier Flexible Retrieval (formerly Glacier) | Long-lived archive data accessed once a year with retrieval of minutes to hours                                        | ≥ 3                | 90 days              | \-                       | \-                                          | Per-GB fees apply |
| Glacier Deep Archive                          | Long-lived archive data accessed less than once a year with retrieval of hours                                         | ≥ 3                | 180 days             | \-                       | \-                                          | Per-GB fees apply |
| Reduced redundancy                            | Noncritical, frequently accessed data with milliseconds access (not recommended as S3 Standard is more cost effective) | ≥ 3                | \-                   | \-                       | \-                                          | Per-GB fees apply |

## Elastic Block Store (EBS)
In EC2 console, you can create **EBS Volume** for attaching to EC2. When you create it, you can select the different Volume types and provisioned storage size

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlfsq7s3wgy31sw1ij6t.png)
Or specify the **EBS Volume** when creating EC2 instance.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/599zvcfkg7hfxw2r9bxp.png)

| Solid state drive (SSD) volumes | Volume type         | Durability                                                    | Use cases                                                                                                                                                                           | Volume size    | Max IOPS per volume (16 KiB I/O) | Max throughput per volume | Amazon EBS Multi-attach | Boot volume |
| ------------------------------- | ------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | -------------------------------- | ------------------------- | ----------------------- | ----------- |
| General Purpose SSD volumes     | gp3                 | 99.8% - 99.9% durability<br>(0.1% - 0.2% annual failure rate) | Transactional workloads<br>Virtual desktops<br>Medium-sized, single-instance databases<br>Low-latency interactive applications<br>Boot volumes<br>Development and test environments | 1 GiB - 16 TiB | 16,000                           | 1,000 MiB/s               | Not supported           | Supported   |
| General Purpose SSD volumes     | gp2                 | 99.8% - 99.9% durability<br>(0.1% - 0.2% annual failure rate) | Transactional workloads<br>Virtual desktops<br>Medium-sized, single-instance databases<br>Low-latency interactive applications<br>Boot volumes<br>Development and test environments | 2 GiB - 16 TiB | 16,000                           | 250 MiB/s \*              | Not supported           | Supported   |
| Provisioned IOPS SSD volumes    | io2 Block Express ‡ | 99.999% durability<br>(0.001% annual failure rate)            | Workloads that require:<br>Sub-millisecond latency<br>Sustained IOPS performance<br>More than 64,000 IOPS or 1,000 MiB/s of throughput                                              | 4 GiB - 64 TiB | 256,000                          | 4,000 MiB/s               | Supported               | Supported   |
| Provisioned IOPS SSD volumes    | io2                 | 99.999% durability<br>(0.001% annual failure rate)            | Workloads that require sustained IOPS performance or more than 16,000 IOPS<br>I/O-intensive database workloads                                                                      | 4 GiB - 16 TiB | 64,000 †                         | 1,000 MiB/s †             | Supported               | Supported   |
| Provisioned IOPS SSD volumes    | io1                 | 99.8% - 99.9% durability<br>(0.1% - 0.2% annual failure rate) | Workloads that require sustained IOPS performance or more than 16,001 IOPS<br>I/O-intensive database workloads                                                                      | 5 GiB - 16 TiB | 64,001 †                         | 1,001 MiB/s †             | Supported               | Supported   |

| Hard Disk Drive (HDD) volumes    | Volume type | Durability                                                    | Use cases                                                                                                                  | Volume size      | Max IOPS per volume (1 MiB I/O) | Max throughput per volume | Amazon EBS Multi-attach | Boot volume   |
| -------------------------------- | ----------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------- | ------------------------------- | ------------------------- | ----------------------- | ------------- |
| Throughput Optimized HDD volumes | st1         | 99.8% - 99.9% durability<br>(0.1% - 0.2% annual failure rate) | Big data<br>Data warehouses<br>Log processing                                                                              | 125 GiB - 16 TiB | 500                             | 500 MiB/s                 | Not supported           | Not supported |
| Cold HDD volumes                 | sc1         | 99.8% - 99.9% durability<br>(0.1% - 0.2% annual failure rate) | Throughput-oriented storage for data that is infrequently accessed<br>Scenarios where the lowest storage cost is important | 125 GiB - 16 TiB | 250                             | 250 MiB/s                 | Not supported           | Not supported |

| Previous generation volumes | Volume type | Use cases                                     | Volume size | Max IOPS per volume | Max throughput per volume | Boot volume |
| --------------------------- | ----------- | --------------------------------------------- | ----------- | ------------------- | ------------------------- | ----------- |
| Magnetic                    | standard    | Workloads where data is infrequently accessed | 1 GiB-1 TiB | 40–200              | 40–90 MiB/s               | Supported   |

## Elastic File System (EFS)
When creating EFS, you need to specify the VPC for deployment.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3m98zqmd5l8hm29swtu.png)
After the EFS deployment, you can change the performance setting to elastic or provisioned. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lmn1kns3175vh53lr7r8.png)
you can run the following commands provided by EFS on Linux EC2 to mount the Network Attached Storage (NAS). **Unfortunately, Amazon EFS does not support mounting from Amazon EC2 Windows instances.**

**Using the EFS mount helper:**
```
sudo mount -t efs -o tls fs-04de9a52fae17a3e2:/ efs
```
**Using the NFS client:**
```
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-04de9a52fae17a3e2.efs.ap-east-1.amazonaws.com:/ efs
```

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

| Storage class                       | Designed for                                                                                               | Durability (designed for) | Availability | Availability zones | Other considerations                                                             |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------- | ------------ | ------------------ | -------------------------------------------------------------------------------- |
| EFS Standard                        | Frequently accessed data requiring the highest durability and availability.                                | 99.999999999% (11 9's)    | 99.99%       | \>=3               | None                                                                             |
| EFS Standard–Infrequent Access (IA) | Long lived, infrequently accessed data requiring the highest durability and availability.                  | 99.999999999% (11 9's)    | 99.99%       | \>=3               | Per GB retrieval fees apply.                                                     |
| EFS One Zone                        | Frequently accessed data that doesn’t require highest levels of durability and availability.               | 99.999999999% (11 9's)\*  | 99.90%       | 1                  | Not resilient to the loss of the Availability Zone.                              |
| EFS One Zone-IA                     | Long lived, infrequently accessed data that doesn’t require highest levels of durability and availability. | 99.999999999% (11 9's)\*  | 99.90%       | 1                  | Not resilient to the loss of the Availability Zone. Per GB retrieval fees apply. |

## Amazon FSx

you need to joins the Windows EC2 instance to your AWS Managed Microsoft AD directory
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wtixj2oq4iprll239ldg.png)
After joining EC2 to the domain/directory, you can run the following commands to mount the NAS to windows EC2

you can replace "Z:" with any other available drive letter
```
//using the default DNS name
net use Z: \\\share
//using DNS aliases
net use Z: \\alias\share
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5qpcxgey9ryvgbs8hjt7.png)




Reference:
https://aws.amazon.com/tw/s3/pricing/?nc=sn&loc=4
https://aws.amazon.com/tw/ebs/pricing/
https://aws.amazon.com/tw/efs/pricing/
https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/general-purpose.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/provisioned-iops.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hdd-vols.html
https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/tutorial-wfsx-volumes.html
https://docs.aws.amazon.com/directoryservice/latest/admin-guide/launching_instance.html