AWS Cloud Computing: EC2 Guide

Tenzin Wangdu
Geek Culture
Published in
5 min readMay 11, 2021

What is Cloud Computing?

Cloud Computing is computing on a server that is being maintained by someone else. It is basically delivering computing services on demand from applications to storage and processing power. In the space of technology, sometimes we need computing power or storage for our data or code to exist and run. So rather than owning an expensive computer or storage, we can use cloud computing as rent on the internet to perform tasks that our computer can’t process.

Benefit’s of Cloud Computing

  • Powerful computers are expensive
  • Easily Accessible
  • No complexity of owning and maintaining a server

Cloud Computing Services

There are many companies that provide large-scale cloud computing services. The main ones are Amazon Web Services (AWS), Google Cloud Platform, and Microsoft Azure Cloud Computing. Currently, AWS has the majority of the market for cloud computing because it was one of the early leaders in the market for cloud infrastructure, and a lot of major company's data are already in the AWS server running.

So in this blog, I will go over how to run an EC2 server from AWS step by step from creating the server and running a program on it.

EC2

Amazon EC2 server is basically a virtual computing environment, also known as instances. So by using EC2, you are able to use access a stronger computer that has access to various configurations of CPU, memory, storage, and networking capacity based on your needs, so you can develop and deploy applications faster. I will guide you through all the steps from creating security, running a server to executing a program on your virtual computing environment. Before that create an account using this link. Then click on the EC2 in the services sections.

Step 1: Security

Before running anything, we need a security key for anything to run. In the left tab of the website, you will press Security Groups in Network & Security. After that create a security group then add a name and description for it and in the inbound rules you need to click SSH in type info, then the source is anywhere. Then click the create a security group.

After that in the Network & Security, click Key Pairs and create a key pair. You can name it anything but make sure the file format is .pem. Then save the .pem file in a location that you can access later.

Step 2: Starting the Server

First, click the Instances in the Instances tab and launch an instance. Then you can a bunch of servers that you can use. For this blog, we will choose the latest Ubuntu Server with free eligibility with 64bit(x86). Choose the free tier one and click Next till the Configure Security Groups. In Configure Security Groups, choose the existing security group and choose the security group that you create in step 1 and then launch it on the next few steps. Now you have a server running in the AWS. In the Instances click the instance id and copy the Public IPv4 address. We will need it later for connecting to a server.

Step 3: Connecting to the Server

Open your git bash and type chmod 700 ‘path to the pem file’ or sudo chmod 700 ‘path to the pem file’ for mac. Then you need to use

ssh -i 'path to the pem file' ubuntu@"Public IPv4 address"

Step 4: Installing Anaconda on your server

wget http://repo.continuum.io/archive/Anaconda3-4.1.1-Linux-x86_64.sh

This will download anaconda on your server. To install Anaconda, you use

bash Anaconda3–4.1.1-Linux-x86_64.sh

After that click enter, press q to exit the license and type yes, and press enter, this will take a while to install, type yes and it is done installing the anaconda. Then you will need to use source ~/.bashrc to activate your bash profile. You can check your python and conda by using which python3 and which conda.

Step 5: Secure Copy Protocol(SCP)

SCP basically means that it is securely transferring computer files between the local host and the remote host. Open a new git bash and then go the path where your program is and use

scp -i “path to pem file” practice.py ubuntu@”Public IPv4 address”:~

Try using ls to see that practice.py or the file that you have is in there.

Step 6: Execute your code

You can run your model like a regular command line and that is basically cloud computing. If your file has an error you can fix it using a nano model.py if you want.

Step 7: Pulling the result back to your Computer

In your local command line, you can type

scp -i ‘path to pem file’ ubunut@”address from the aws”:”path to file from the server” .## include the . as well,it means from the current directory in the server

After that, it should be on your computer. If you want to use the server again then you can stop the instance or else terminate it. Terminate your instances by clicking the instances in the instances tab, then in instances, state terminates instances and delete the key as well. In the terminal, it should say the connection lost or closed.

--

--