AWS Storage Options
Here are the storage options offered by AWS:
- EBS (Elasctic Block Storage)
- EFS (Elastic File Storage)
- S3 (Simple Storage Service)
- Instance Store
EBS
- An EBS store can only be mounted to one EC2 instance (BUT an instance can have multiple EBS volumes attached to it)
- The EBS store must be in the same AZ as the instance
- You specify the size of it and can change it later
The instance sees this as an attached hard drive.
The data is retained when the instance is stopped, but if you terminate an instance, the EBS volume will also be destroyed.
So make sure that if you want to retain the data without the instance, you have these options:
- Change the 'delete on termination' default option when launching the instance
- Create a snapshot before terminating the instance
- Detach the volume (before terminating the instance), so that you can attach it to another instance
An EBS volume can only be accessed by instances in the same AZ.
EFS
The instance sees this as a shared network folder.
You can attach an EFS volume to multiple EC2 instances at the same time.
You can attach an EFS volume to any instance the same region (you set the volume up as 'Regional').
EFS volumes will not handle locking/concurrency, which means that you (or your apps) must maintain the integrity of the files on the volume.
You only pay for the amount of data that you put on the EFS store (unlike EBS where you choose the size of the drive and pay for that size)
S3
Object storage
- Object - you can think of an object as a file?
- Can be integrated with CloudFront (CDN) to put files close to your end users
- You can define Events so that code can be triggered when files change in an S3 bucket
- could be a lambda function
- or SQS message
- or SNS notification
- You can allow access to other AWS accounts
- Many AWS services use S3
- You can configure S3 to replicate data to other regions
Instance Storage
Storage that is directly attached to the hardware that the instance runs on. Because of this, instance storage is fast.
If you stop the instance, all the data is lost (they are ephemeral). But if you reboot, the instance storage data will be persisted.
Instance storage is good for caches, buffers, or temporary storage.
Some instance types have instance stores by default (ones that are optimized for high speed temporary storage), but most instance types default to an EBS volume.