AWS Instance With EBS Volume.
Amazon EC2 Services
Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.
Lets set up an instance for our cluster.
Step:1
Open amazon management console. In the search options
Type EC2 on the search box > select EC2 services.
Step: 2
Launch Instance > Select free-tier Redhat Os
Free-tier — The AWS provides customers with the ability to explore and try out AWS services free of charge up to specified limits for each service. In this scenario, we have 12 months of instant access with 750 hours of free service after which they will charge you on the basis of your usage.
Step 3: Configure instance details
We will not change any information on this page as there is no specific requirement for it.
Step 4: Add Storage
Here we can decide on providing our machine with a desirable amount of storage space in the background AWS uses EBS storage service to provide the storage infrastructure under the free-tier instance we can set up to 30 GB storage space at only.
We have used 10GB storage space as that’s enough this experiment.
Step 5: Add Tags
Now if you want you can skip this step but it’s really helpful in terms of referring your instances later to manage them properly.
Step 6: Configure Security group.
Security plays a very vital role in terms of cloud services as anyone can interfere with your system if it’s not configured properly, We get to set different access permission for different protocols (ICMP, HTTP ..etc).
Here we are going to allow all the traffic inputs to access our systems
For now, so that all the other systems can connect to our system without any hurdles.
We have selected All Traffic so that it is accessible to every system on the internet who have key and authorization to access your system.
Step 7: Review instance Launch
Before we can finally launch instance we get the option to select an existing key pair or create one. Create a new key pair and provide a name to it.
Once completed downloading the key-pair in your system. Keep it safe with your other files because your instance can be accessed through remote login only using these keys.
Now click on the Launch and you will see your instance running on Instance dashboard.
If you click on the instance id you will be redirected to the instance Dashboard.
Congratulations! we have successfully completed the instance set up on the AWS.
Setting up EBS volume for your instance.
Step :1
Once we have created instance on the left of the screen we can see the Volumes option under Elastic Block Store Click on it and Create new Volume.
Give the desired Size and name that you need for you instance volume and Click on create volume.
Step :2
Right click on the volume created and click on attach Volume.
Note:- EBS services are not global hence we can only attach our volume to the instances that comes under the same zone and region data center. for e.g. -
I have created instance in Mumbai 1b region .So, I can attach my volume that are created in the same region.
Step :3
Go to your instance and check the storage attached to you instance using command.
#to check disk connect to our system
fdisk -l
Here you can notice a new volume added to your instance of size 1 Gb.
Step :4
Now we have successfully added volume to our instance now its time to create partition .In any OS it is very important process to create partition in a disk to make use of it , we can have two kind of partitions primary and extended .
Here am using just primary partition for demonstration purpose you are free to experiment with partitions. To create partition we have to define on which disk we are performing partition.
Type following command to make partition.
#to make partitions
- fdisk /dev/xvdf
As you can see in the above picture type “n” for command to initialize the partition and press enter for 4 times to select all default options.
Once the partition is created you will see the message at the end of your console “Created a new partition 1 of type ‘Linux’ and of size 1023 MiB”.
Note: By default if we don't provide partition size our system takes complete size of volume into one section under primary partition.
The above picture displays the created partition in the system as /dev/xvdf1
Step :5
Before using any partition it is important to format the disk for usage.
Disk formatting is the process of preparing a data storage device such as a hard disk driver, solid-state driver, floppy disk or USB flash driver for initial use. In some cases, the formatting operation may also create one or more new file systems. The first part to formatting process that performs basic medium preparation is often referred to as “low-level formatting”.
Portioning is the common term for the second part of the process, making the data storage visible to an operating system. The third part of the process, usually termed “high-level formatting” most often refers to the process of generating a new file system.
To read more about formatting please follow the link below :
To format your partition in the instance type the following commands.
#to format the partition.
mkfs.ext4 /dev/xvdf1
Step :6
Once formatting is done your partition is ready to be mounted and used in your AWS instance.
Create a drive inside your root directory and mount the partition to your directory Using following commands
#changing directory to root
cd /
#making directory
mkdir mydrive
#mounting partition to the directory
mount /dev/xvdf1 /mydrive
#to check attach drive
df -h
Congratulations !👏 now your EBS volume is attached to your instance and ready to be used as a external storage device.
Some benefits of using EBS Storage:-
- Performance for any workload
- Highly available and durable
- Virtually unlimited scale
- Easy to Use
Please leave your comments down below for any queries and suggestions.
Keep exploring! 👦💻❤️😇
written by :- Swapnil Lader