100% found this document useful (1 vote)
192 views29 pages

Elastic Block Store (Amazon EBS)

Elastic Block Store (EBS) allows you to create storage volumes that can be attached to EC2 instances to provide persistent block level storage. EBS volumes exist independently from EC2 instances and can be attached to multiple instances over their lifetime. This document provides an overview of how to create and manage EBS volumes including creating and attaching volumes, creating snapshots for backup and migration, and migrating volumes across regions and accounts. It also covers troubleshooting techniques like recovering access to an instance if its key pair is lost.

Uploaded by

hanuman challisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
192 views29 pages

Elastic Block Store (Amazon EBS)

Elastic Block Store (EBS) allows you to create storage volumes that can be attached to EC2 instances to provide persistent block level storage. EBS volumes exist independently from EC2 instances and can be attached to multiple instances over their lifetime. This document provides an overview of how to create and manage EBS volumes including creating and attaching volumes, creating snapshots for backup and migration, and migrating volumes across regions and accounts. It also covers troubleshooting techniques like recovering access to an instance if its key pair is lost.

Uploaded by

hanuman challisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Elastic Block Store (Amazon EBS)

An Amazon EBS volume is a durable, block-level storage device that


you can attach to a single EC2 instance.
You can use EBS volumes as primary storage for data that requires
frequent updates, such as the system drive for an instance or storage
for a database application.
Topics to be covered--EBS

1. EBS Introduction
2. Creating Volume
3. Attaching Volume
4. Making partition and accessing it
5. Detach and attach to other instance
6. Creating snapshot
7. Create volume in other subnet using snapshot
8. Attaching to other instance
9. Modifying Volume
10. Migrating volume from one region to other
11. Migrating volume from one account to other
12. Modifying Instance
13. Troubleshoot lost key pair of linux instance
Creating an Amazon EBS Volume
• You can create an Amazon EBS volume that you can then attach to any EC2
instance within the same Availability Zone. You can choose to create an
encrypted EBS volume, but encrypted volumes can only be attached to selected
instance types.

• You can apply tags to EBS volumes at the time of creation. With tagging, you can
simplify tracking of your Amazon EC2 resource inventory. Tagging on creation
can be combined with an IAM policy to enforce tagging on new volumes.
How to create EBS and attach to instance

Create two Windows Instance in same subnet

In AWS console – EC2 – volume –Add volume–


Select size (5 GB) – Add tag : Name – managed
disk-1 – create

After creating –select it –action –attach volume—


select instance –Attach—close
Now open the instance and create partition to
access it
Open EC2 Console-Click on volume
Give the EBS size and add tag then create volume
Attaching Volume
Select the created volume-Action-Attach Volume
Select the running instance available on same availability zone
Attaching and Detaching the EBS volume (Windows)

1)Attach EBS volume in one instance ---keep some data


there.

2) Detach the volume and attach to the second instance.

3) Open/connect the second instance---server manger—


computer management – disk management –right click on
added disk – make online.

4) Come to my computer –you will get your volume here


Create partition in linux
After adding disk to linux Instance – connect the Instance using
mobaextrem or any tool
$ sudo su
# fdisk –l
# fdisk /dev/xvdf
type –n then p then type 1 then press 2 times enter then type w
#mkfs.xfs /dev/xvdf1
#mkdir /share1
#mount /dev/xvdf1 /share1
#cd /share1 :-- this is your external disk space
Permanently mounting File system
# vi /etc/fstab
At the end of line add
/dev/sdb1 /share1 xfs defaults 0 0
Attaching and Detaching the EBS volume (Linux)

1)Attach EBS volume in one instance ---keep some data there.

2) Detach the volume and attach to the second instance.

3) Open/connect the second instance-


$sudo su
# fdisk –l
# mkdir /storage1
# mount /dev/xvdf1 /storage1
# cd /storage1
Migrating volume from one Account to other

Select the volume—Action –Create snapshot-then go to snapshot-action—modify


permissions
Migrating volume from one Account to other

Put other aws account number here


How to check in other account

1) EC2 --- Elastic block store --snapshot—click on owned by


me--
How to check in other account

Owned by me –public snapshot—You will get share snapshot


from other account –--go to action—create volume
Migrating volume from one Region to other

Create Snapshot—Go to snapshot---Action—Copy –select destination—


Singapore—copy

Go to Singapore –select the snapshot –Action—Create Volume

Now attach to any Instance and check the data


Modifying Volume--Instance

Modifying Root Volume of Instance


1) Modify the volume size from aws console volume.
2) Connect the instance
# df –h
# lsblk
# growpart /dev/xvda 1
# lsblk
We increased block storage, but we also need to increase file system:
# xfs_growfs /dev/xvdf1
# df –h
Modifying Volume--EBS

Modifying Root Volume


1) Modify the volume size from aws console volume.
Note: ebs should have xfs file system (hint: mkfs.xfs /dev/xvdf1)
# df -h
# lsblk
# growpart /dev/xvda 1
# lsblk
#xfs_growfs /dev/xvdf1
# df -h
Troubleshooting
1) How to recover lost keypair and access the instance.
Ans:
a) Create one more recovery instance.
b) Stop the victim instance
c) Go to volume – select victim instance—action—detach volume
d) Again go to action—attach volume—select—recovery instance
e) Connect recovery instance –
# lsblk
# mkdir /recovery
#mount -o nouuid /dev/xvdf2 /recovery
# df -h
# cat /home/ec2-user/.ssh/authorised_keys >> /recovery/home/ec2-
user/.ssh/authorised_keys
#umount /recovery
Troubleshooting
f) Go aws –volume—select victim instance—action –detach
volume—
g) Again go to action –attach volume—select stopped server –
device: /dev/xvda ---attach
h) Now go to ec2 instance—copy public ip of victim instance and
connect

You might also like