Cloud Computing for Dummies

Kritika Agarwal
7 min readMay 29, 2021

If you’re an engineer still struggling to understand why Cloud Technology is most popular or why it is the one stop solution for every company, or you want to explain it to your six year old child, this article is for you. Let’s first start by answering what cloud is not?

Sorry to break your bubble there, but cloud isn’t magic and is entirely a concept made by humans, for humans, just like God and Crypto-currency and every other thing in life.

Since we’ve parked that out of the picture, let’s start by answering the right questions, what is Cloud?

Imagine you’re a strong powerful software engineer, you know how to code and you have this cool website that you’ve recently built. You launched the website today, and tweeted about it. Now using Network Effect, your website became very popular and all your buddies start using it.

Day 1 you’re ecstatic, cos your traffic is higher than Bangalore roads and you will now need to “scale your infrastructure” a fancy term for adding more computers so that more people can come visit your website without requests dropping. But buying these new computers would be expensive, and then adding all tools and combining these computers to serve all requests to every computer you buy, super tiring!

Photo by Cris Saur on Unsplash

Remember old days when mom didn’t allow you to buy movie DVD’s, and you used to rent them from a shop? Cloud Computing is pretty much the same thing where instead of buying and handling all your computers you can ask big companies like Microsoft, IBM, Amazon etc to rent their computers to you so you can only focus in building your website by paying a small rent fees.

What can I rent with Cloud Computing?

Let’s look at the popular types things people like renting:

  1. Software as a Service(SAAS): Grown-ups won’t allow you to play cool games on your laptop? SaaS helps you play them online. All great softwares which are either too expensive or too bulky are now available online thanks to Cloud.
  2. Platform as a Service (PAAS): Here you can rent things that you require to build the website eg. Java run time environment, operating system, storage, database, firewall etc. (Less expensive than IaaS, but sucks out the fun to get your own computer too).
  3. Infrastructure as a Service (IAAS): This is like renting the whole computer. Here the companies give computers with any amount of storage, network, and operating system you ask them for.
  4. Storage as a Service(STAAS): You can get as many pen-drives, hard-disks, and space you’d need to store all your cool pictures, videos, and your website’s data. This can be divided into 2 things:

a) Object Storage(NAS): These are storage spaces where you can only upload files and folders eg. Google Drive, Dropbox etc.

b) Block Storage(SAN): These are places where you get the whole block of hard disk to yourself and do anything (even deploy operating system on it).

Photo by Ben White on Unsplash

So, guess you get the gist. Everything you want, the Cloud helps you get it.

If you’re excited to become BIGGG like these cool & big software companies and want to rent out your own cloud, let’s look at DIY tips and tricks to create your own cloud. P.S. only strong powerful engineers should read ahead and try DIYs at their own risk.

Photo by Mikael Seegen on Unsplash

Before jumping into implementation let’s look at these concepts:

Partitioning in Hard Disk: Usually whenever you try to load an Operating System, it takes up all the space/mounts itself to have all the available space on the hard disk. The question then arises, how can we install mutliple OS on a single machine?

a) Primary Partition: These are like slicing hard disk into physical partitions. Max 4 partitions are allowed. At a hardware level, the storage space is split into these partitions such that each partition is unaware of the other one. This is the reason you can load multiple OS on a single hard disk.

b) Logical Partition: This creates only logical separations but not actual hardware disks, a concept similar to software and hardware vs software threads.

c) Extended Partition: These can not be used directly and needs to be divided further into logical partitions.

DIY#1: Implementing Storage as a Service.

Storage as a Service is achieved when GUI is rendered on the client’s screen whereas the computation/event is actually persisting on the server. The objective is mainly to provide softwares across platforms(eg. Wine) and easy affordability of expensive softwares. This DIY will require you to use 2 PC’s (client and the server).We will achieve this by using the protocol X-Window Forwarding .
In the example given, we’re trying to copy firefox from server A to client B. Steps for Linux Users:

1. Check if X11 Forwarding is enabled?
Open file /etc/ssh/ssdh_config and enable X11Forwarding to yes .
2. Create a new user at server which should be allowed to ssh by client. (Security purposes).
Commands: useradd testUser, password ****
3. Allow client B to use ssh protocol to server A by adding user details (can be done per user/for all users).
Commands: AllowUsers testUser@clientIP
4. Do ssh restart after configurations.
Command: service sshd restart
5. From client ssh to the server to get firefox.
Command: ssh -X -l testUser serverIP firefox
6. Once the file is copied, give executable permission to the file, chmod 777 and execute it. File to be found in usr/share/applications folder
Similarly to use wine the command would be
ssh -X -l serverIP "filepath_for_exe"

DIY#2: Implementing Object Storage in Linux.

Object storage is achieved by mounting a storage space available in the Cloud Server to a client’s location i.e folder would be visible at the client’s end but actual space would be occupied at server. This can be implemented using protocols like NFS, Samba, or SSHFS. Object storage provides you well mounted storage space on a shared disk rack with RAID implemented to ensure no data loss. Here we’ve implemented using SSHFS since it provides authentication as well as encryption capabilities. We will need a hard disk, a client PC, and a server PC to do this exercise.

1. Install sshfs.
Command:sudo apt-get install sshfs
2. Create partitions of hard disk of required size using fdisk/partx commands. eg. Command: partx -a /dev/sda10
3. Create a physical volume, volume group and then finally a logical volume to be shared. You could create different sets of physical volumes/partitions from different spaces in your internal hard disk, external HDD and then combine them all to create volume groups, which can then further be broken into logical volumes. Follow link
Command: lvcreate -L 1000M -n data test
4. Give permissions to data folder.
Command: chmod o-rx /data , ls -ld /data
5. Make a directory/mount point at the Client Side.
Command: mkdir /media/dropbox
5. Use sshfs to copy the partition.eg.
Command: sshfs 192.168.0.20:/data /media/dropbox

Voila! You’ve implemented your own dropbox media storage. One can always unmount, increase/decrease the storage volume using lvexpand and lvcollapse.

DIY#3: Implementing Block Storage in Linux.

Block/Load storage is a lil more intimidating and can be achieved using iCSCI protocol. Here, the client aka initiator creates a Discovery request to it’s target i.e STAAS provider which then provides a unique IQN number to load drivers for the disk. Link. We will need a hard disk, a client PC, and a server PC to do this exercise.

1. Install iscsi on server
Command:yum install iscsi rmp -q openssh-server rmp -q scsi-target-utils
2. Create full space partition in HDD same as DIY#2 and do not format/mount the partition.
3. Go to targets.conf file and add your entry of the partition here. eg.
Command: cd /etc/tgt vi targets.conf <target mycloud> backing_store /dev/sdb1 </target>
4. Restart iSCSI service.
Command: service tgtd restart start service
5. To test protocol at server end, use command tgt-admin show
6. Install iSCSI initiator at the client.
Command: yum install iscsi-initiator-utils
7. Discover iSCSI initiaor.
Command:openssh-server iscsiadm --mode node --targetname mycloud --portal 192.168.0.20:3260 --discover
8. Login to iSCSI server from initiator eg.
Command: iscsiadm --mode node --targetname mycloud --portal 192.168.0.20:3260 --login
9
. To logout use the same command with logout option.
Command: iscsiadm --mode node --targetname mycloud --portal 192.168.0.20:3260 --logout

In case resize is done(using lvextend), use tgt-admin force-reload tgt-admin restartinstead of resize2fs command to enable the reload in real time.

IAAS is implemented by creating Virtual Machines (VMs) on the server end according to the client configuration and then clients get to login to the VMs using GUI/CLI. Let’s look at some more concepts to before jumping to building IAAS.

HyperVisor: Hypervisor provides virtualization layer on existing hosted machines to be able to provide virtual machines for IAAS.

  1. Type 1 Hypervisor: Hardware assisted hypervisors/bare metal eg ESXi, hyperV, KVM requires configuration at hardware level to create virtualization layer.
  2. Type 2 Hypervisor: Software virtiualization/ Hosted virtualization is achieved using Type2 hypervisors eg. Quit Emulator(Qemu-KVM).

Detailed instructions to implement IAAS are given at link.

As Ken Blanchard says, “Feedback is the breakfast of champions”. It would really raise my spirits if you can reach out with feedback/comments. Drop in a message to say hi.

--

--

Kritika Agarwal

Software Engineer, Mentor, Blogger, Shitposter, hustling for goals to become history. https://linktr.ee/kritika.agarwal