AWS Classroom notes 20/Jan/2024

AWS EBS Contd

Activity 1: Mount the ebs volume to /tools in ec2 (linux flavored)

  • Create an ec2 instance with ubuntu os
  • for partitions Refer Here
  • Attach an ebs volume to ec2
    Preview
    Preview
    Preview
  • Refer Here for linux file systems
  • Create a filesystem for volume
sudo mkfs -t xfs /dev/xvdf

Preview
* Make a note of block id by executing sudo blkid

/dev/xvdf: UUID="4236cfcf-c889-447b-a3b5-f851e60436c9" BLOCK_SIZE="512" TYPE="xfs"
  • Now lets mount the disk to the tools folder
sudo mkdir /tools
sudo mount /dev/xvdf /tools
  • list the mounts
    Preview
  • now lets create some files in /tools
sudo touch /tools/1.txt

Preview

Actvity 2: Ensure mounts persist across restarts

  • stop the ec2 instance and start again
  • ssh into ec2 instance and execute
ls /tools
  • list the mounts
sudo df -h

Preview
* To ensure your ec2 instance retains mounts we need to add entries into /etc/fstab
* add the following entry into fstab and stop and start the ec2 instance

UUID=4236cfcf-c889-447b-a3b5-f851e60436c9   /tools   xfs   defaults,nofail   1   2
ls /tools
  • list the mounts
sudo df -h

Preview

Activity 3: EBS Snapshots

  • Backup of EBS is called EBS snapshot
  • EBS volume will be available in a zone, where as snapshot is available in a region
  • Create a snapshot
    Preview
    Preview
  • From snapshot we create recreate an ebs volume
    Preview
  • Using the snapshot we can create the volume in any az in same region
    Preview
    Preview
  • We can copy the snapshot to any region and create a disk there
    Preview
    Preview
  • Once the snapshot is copied, create an ebs volume in any zone and attach to ec2
  • Lets automate the snapshot creation
    Preview
    Preview

Activity 4

  • Create an ec2 instance in one region A (us-west-2 oregon)
  • Create an ec2 instance in other region B (ap-south-1 mumbai)
  • In an ec2 instance in region A, Attach an ebs volume of type gp2 and size 1 GiB.
  • mount the volume to /projects folder
  • now create some files in /projects
  • create a snapshot, copy the snapshot to region B and attach the disk created from this snapshot to ec2 instance in Region B

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube