Launch EC2 Instance and Attach EBS Volume to Instance in AWS

Today i would like to share step by step procedure to launch the EC2 Instance and attach a EBS volume to it

This Blog Divided Into Two Parts

  • Basic Concepts
  • Setup Procedure

Basic Concept


Amazon web service is a cloud computing solutions The platform is developed with a combination of infrastructure as a service (IaaS), platform as a service (PaaS) and packaged software as a service (SaaS) offerings.

AWS offers a wide range of different business purpose global cloud-based products. The products include storage, databases, analytics, networking, mobile, development tools, enterprise applications, with a pay-as-you-go pricing model.

AWS Services we are using in this practical

1. Amazon Elastic Compute Cloud (Amazon EC2):

EC2 is a virtual machine in the cloud on which you have OS level control. You can run this cloud server whenever you want.

components we see while launching EC2 , lets understand that

  • Amazon Machine Image (AMI): The machine images are like templates that are configured with an operating system and other software. (think like an ISO for which provide OS Environment to Instance)
  • EC2 instance types: Each instance type delivers a mix of CPU, memory, storage, and networking capacity, across one or more size options, and should be carefully matched to your workload’s unique demandsAWS groups instances into families like General Purpose, Compute Optimized, Memory Optimized, Storage Optimized
  • security group: A security group acts as a virtual firewall for your EC2 instances to control incoming and outgoing traffic.
  • Key Pair: SSH protocol support key pair based authication. A key pair, consisting of a private key and a public key, is a set of security credentials that you use to prove your identity when connecting to an instance. Amazon EC2 stores the public key, and you store the private key. You use the private key, instead of a password, to securely access your instances.

2. Amazon Elastic Block Store (Amazon EBS):Amazon Elastic Block Store (Amazon EBS) provides block level storage volumes for use with EC2 instances. EBS volumes behave like raw, unformatted block devices. You can mount these volumes as devices on your instances

volume types: General Purpose SSD, Provisioned IOPS SSD, Throughput Optimized HDD, and Cold HDD.

Setup Procedure

  1. Launch EC2 Instance
  2. Create EBS Volume
  3. Attach Volume to an Instance


  • After Login to your AWS console → EC2 service → dashboard →Launch Instance
  • Select the AMI image according to the required OS

Users can select an AMI provided by AWS, the user community, or through the AWS Marketplace. Users can also create their own AMIs and share them.

  • Select the instance type , here i am using general purpose with 1 CPU and 1 Gib Memory this combination of CPU and RAM is name as t2.micro more about type
  • Configure Instance contains NO. of instances we want to launch in 1 go , Subnet , Select the VPC
  • EVERY System required storage so we have to add the storage according to the OS for Example Linux required minimum 8Gib and windows 30Gib
  • In security group we can put the Inbound and Outbound rules accordingly, but 22 port for SSH protocol is enabled by default to access the Instance , in EC2 password authentication is disabled ssh is only way.
  • create a Key Pair and also download the private key

And EC2 Instance is launched successfully

IN dashboard we can see the running instances which we created


  • IN EC2 Dashboard there is a option of Volumes in EBS → create volume
  • Specify following things * Volume type used general purpose SSD , * size of disk and the Availability zone as Instance

NOTE ::- Volume and instance should belong to same Availability zone

and volume is created successfully!!

Here we can see the new volume come up and the state of volume is Available, we haven't attached it


  • Action → Attach Volume
  • Select the running instance from respective Availability zone

And volume Attached to instance successfully and the state of volume also changed to in-use

but if we try to use this volume to store we wont find it because EBS is a raw disk , and to do this execute following command in EC2 Instance

we have to follow 3 steps to use this disk

  1. creates partition 2. format the partition 3. mount it
  • command to list disk

fdisk -l

  1. to create partition of disk

fdisk /diskname

2. Partition created lets format it, command is where /dev/xvdf1 is the partition name

mkfs.ext4 /dev/xvdf1

3. mount on a folder, command is

mount /partition_name /folder_name

to see the partition we have a command

df -h

NOw any data put on the /ppp folder it will store in the EBS volume

******************************Thank You **************************




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Entropy Volunteer Global Recruitment Program is Launched

3 steps to set up the best cost performance deep-learning powered raspberry pi camera with OpenNCC

Google Domains + Gatsby + Github Pages + HTTPS


Mayday Messaging is the first app using Booster

Elasticsearch Optimizations at Lyft

DPGU Airdrop $50k

7 Habits You Can Master to Become a Good Programmer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akanksha Chhattri

Akanksha Chhattri

More from Medium

How to add GUI Desktop in AWS Ubuntu server EC2

Installing Docker on an AWS EC2 instance

Docker engine on AWS EC2 architecture

Creating a Static website using S3

Securing Your Aws Account.