So in this Chapter, we will discuss the topics related to AWS ***
Analogy:Think of them as a “network USB stick”
Free tier: 30 GB of free EBS storage of type General Purpose (SSD) or Magnetic per month
You can create a EBS and then attach it to an EC2 instance. But making it available for Linux servers is out of the CCP exam scope.
EBS is indeed in bound of availability zone, meaning that an EBS created, let’s say us-east-1a, can not be attached to an EC2 instance from another availability zone: us-east-1b.
Even though EBS is available zone bounded, but snapshots of EBS can be copied to another availability zone.
EBS SNAPSHOT archive tier is 75% cheaper, but it takes 24 ~ 72 hours to restore. So it’s suitable for those data that not you are not so hurry to use.
You can delete the snapshot, and set the retention policy(1 day ~ 1 year). Within the duration of the retention, you can recover the accidentally deleted snapshot.
Copying snapshots to another availability zone is very often the usecase of disaster recovery.
With snapshots, you can also create EBS volume from it. Similarly, the newly created EBS volume doens’t have to be in the same availability zone. And from the volume list menu of the portal, you can
recognize the origin snapshot of the volume from the “snapshot” column.
Recycle Bin
Protect your Amazon EBS Snapshots and Amazon Machine Images (AMls) from accidental deletion.
Use Recycle Bin to protect your business-critical EBS Snapshots and AMIs from accidental deletion. With Recycle Bin, you specify a configurable retention period within which you can recover these resources after they have been deleted.
Lock setting of retention rule:
• Unlock
The retention rule can be modified or deleted at any time by a user with the required permissions.
• Lock
The retention rule can’t be modified or deleted until it is unlocked by a user with the required permissions, and the specified delay period has expired.
AMIs
Hands-on
- Launch an EC2 instance
when launching this EC2 instance, we just put below lines into the user data: and it takes 1 ~ 2 minutes to launch because of the initialization and http installation.1
2
3
4
5
6
7!/bin/bash
Use this for your user data (script from top to bottom)
install httpd (Linux 2 version)
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd - create an AMI from the instance





- Launch an EC2 instance from the AMI just created.
This time we chose the AMI that created and owned by myself and put only this line:shell echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.htmlinto the user data


You can feel that it’s much quicker for this 3rd instance to be available than the 2nd one, because the http is already installed back then and when we create AMI from 2nd instance, it’s also encapsulated into it.
Image builder overview
EC2 Instance Store


EFS

EFS V.S EBS

EFS IA

Shared Responsibility Model for EC2 Storage

Amazon FSx



Summary
• EBS volumes:
• network drives attached to one EC2 instance at a time
• Mapped to an Availability Zones
• Can use EBS Snapshots for backups / transferring EBS volumes across AZ • AMI: create ready-to-use EC2 instances with our customizations • EC2 Image Builder: automatically build, test and distribute AMls • EC2 Instance Store:
• High performance hardware disk attached to our EC2 instance • Lost if our instance is stopped / terminated
• EFS: network file system, can be attached to 100s of instances in a region • EFS-IA: cost-optimized storage class for infrequent accessed files • FSx for Windows: Network File System for Windows servers • FSx for Lustre: High Performance Computing Linux file system
Cleanup
Before move on, we need to check the services that might cause a bill.
We’ve left the Security Group and , because AWS won’t charge us for those two.
Instance termination:



SNAPSHOT deletion
When we are trying to delete the snapshot, it failed with a prompt:


Hence, we first, deregister the AMI that’s using the corresponding snapshot, and then remove the snapshot successfully.
AMIs deregister
You can deregister directly or first disable and then deregister. Here, we’ve shown the latter one.





Everything is cleaned. And we are good to go.