Getting Started with AWS

Hello all, I hope you all are doing great. Today I wanted to share about AWS again. Few days back I had posted “Why so much hype about AWS?”. This post was all about What’s and Why’s about the AWS (I do hope all the What’s and Why’s has been answered but if you still have any more questions, do get in touch). Today we are gonna dive even deeper and answer the How’s about the AWS. We will start with very brief about the types of services that we can leverage even at individual level but do mind that the services generally comes with a cost, so be very careful while using or deploying any services using AWS.

So let’s begin. By now I hope you have created an account on AWS, if not then I strongly recommend to go and create an account first and then come back here. Visit AWS website, click on “Create an AWS Account”, for rest of the steps please follow this video tutorial. Once done come back here and we will continue. Also I strongly recommend to check out my previous post first, if you haven’t done it already.

Login into your aws account using the credentials that you have provided during registration. These credentials are also known as root credentials or root account. Preserve this credential at all cost and do not share it with anyone at all, after all it is your credit card details registered with AWS. Once you login aws you will see all the available services, regions on the home page. Here is how it looks like.

AWS SERVICES

Now you guys will know I was not kidding when I said — “I was quite overwhelmed by seeing the number of services provided by AWS”. There are over 70+ services and Amazon AWS team are continuously working towards adding new services regularly. Now well do not get cold feet here, we will take baby steps approach here, take one service at a time, understand what it is and implement the same and then move on to other services likewise, I suggest that should be the way to go about it. As you all can see there are various categories of services and each category has some services in it. We will try to cover as many services as we can but in future post. In my previous post, I’ve mentioned about some basic services of aws. Let’s start with those services first. Yes, I’m talking about EC2 — Elastic Cloud Compute.

EC2 – Elastic Cloud Compute

So let’s just dive into it. Here is how EC2 dashboard looks like.

EC2 Dashboard

Before we begin to use EC2, Please take a note of this. Remember I told you about the global footprints in previous post, well you will able to visualize that more clearly now. Even if you don’t remember, AWS has data centers all over the globe, and they are continuously working to expand even further to reach out to clients and customers in remote location. Check out the global footprint from their website. Whenever you deploy a resource using any services, it has to be deployed in one the regions that provides that service. Always make a note of the region you are currently working. I strongly recommend that choose one region in beginning and never change it, use that particular region throughout, that way it becomes quite easy to track the resources and stay within the free tier limit if applicable.

We can change the region anytime from top-right corner. Here are the list of regions current available at the time of publishing this blog-post.

Region

Choose a region as you like. For me I prefer us-east-1 (N. Virginia) because it supports every services that AWS has to offer. Once you made a choice, come back to EC2 dashboard we will start deploying some computing capabilities.

New instance

Click on “Launch Instance”

Launch Instance - AMI

Here you can see the list of AMI (Amazon Machine Image) available for deployment. There are few AMI’s which are eligible under free-tier, you can choose any AMI that is available here. I strongly recommend to start with AMI which are eligible for free-tier. In this walkthrough we will use “Amazon Linux” AMI, so go ahead and choose “Amazon Linux”

Launch Instance - Instance Type

Choose the Instance Type as “t2.micro”, because that is the only Instance Type which is available in Free-tier. Select “t2.micro”. At this stage we can skip the rest of the steps directly and go to “Review” stage by clicking on “Review and Launch”, doing so AWS will take the default values for the Instance. But since this is the first time we are deploying an Instance via AWS, we will go through each and every step and understand the different customization and configuration available for the Instances. Click on “Next: Configure Instance Details”

Launch Instance - Instance Details

Number of instance — 1 (The number can be increased, if multiple Instances with same configuration is required)
Network — vpc-********* (default) (Use default vpc now, later we can create and configure a VPC and use it)
Subnet — subnet-******** | Default in us-east-1e (Use one of the default subnet, later we can create and configure more subnets and use them)
Auto-assign Public IP — Enable (By enabling this option, Public IP will be assigned to the instance, which is accessible globally)

Let the other options be default. You can update those as well. For more information about those option, hover the mouse pointer over the “i” (information) symbol next to name. Once done Click on “Next: Add Storage”

Launch Instance - Add Storage

We can manage storage for Instance at this stage. Choose the storage size and type. We can add additional disk as per requirement. Do take a note of the information displayed “Free tier eligible customers can get up to 30GB of EBS General Purpose (SSD) or Magnetic storage” Once done we can proceed by clicking on “Next: Add Tags”

Launch Instance - Add Tags

At this stage we can add/remove tags to the instances. Tags can be used as an identifier and are generally stored using key-value pair. Tags are used to help you manage your instances, images, and other Amazon EC2 resources, you can optionally assign your own metadata to each resource in the form of tags. Learn more about tagging from AWS. I’ve added a tag with key “Name” and value “Techsimply-VM-01”, assign some value to Name key and click on “Next: Configure Security Group”

Launch Instance - Security Group

Security groups are most part in deploying the Instance. Here we can configure access to the Instance. You can create a security group and add rules that reflect the role of the instance that’s associated with the security group. For example, an instance that’s configured as a web server needs security group rules that allow inbound HTTP and HTTPS access, and a database instance needs rules that allow access for the type of database, such as access over port 3306 for MySQL. Once done click on “Review and Launch”

Now we are at last stage (almost) “Review Instance Launch”, Review the configuration and once done click on “Launch”.

Launch Instance - KeyPair

We have covered the configuration of VM, who can access it, the only thing left is to configure how to access it. Amazon AWS uses password-less authentication to ssh to its instances. We create a private key here, store it in secure location and use it to ssh to the instance. The key is only available to download at the time it is created, do not lose it. Once you have downloaded and securely stored it in safe location, click on “Launch Instances” and AWS will start deploying the Instance as per the configuration set in earlier stages. You can check the launch logs or simply scroll down a bit and click on “view Instances” to see your instance in EC2 console. Wait for some time until the Instance Status becomes “Running”

EC2 - Running Instances

Our VM or AWS Instance is ready and running. Lets ssh into our instance and check it out how it works. We have assigned a Public IP to our instance, so we can connect to it via Public IP or Public DNS. Private IP or Private DNS will not be accessible via Public network, if want to use it, you must be inside the VPC network first and then try ssh to private IP/DNS, we will check that later but for now we will use Public IP/DNS to connect to our newly created instance.

Connecting to a remote Linux instance is different for windows and Linux. We will go through both. One more thing before we start, we have IP/DNS for VM, we have private file to authenticate, but we don’t know the username that goes with the private file right. Yes, the username is different for different flavors of Linux. I’ve consolidated them into a single table for your reference take a note before proceeding.

OS/Distribution Username
Amazon Linux ec2-user
RHEL 6.3 & Earlier root
RHEL 6.4 & Later ec2-user
CentOS centos
SUSE root
Ubuntu ubuntu
Debian admin

We now have all the information required to connect to our instance. So let’s connect to our instance via Linux OS first and later we will see, how to connect to our VM instance using Windows OS. Login into your Linux instance first. Make sure you have access to the private file that was created/selected while deploying the instance in our case we created a new key-pair file “techsimplyfy.pem”. Ensure that the current user has elevated privileges. Update the file permissions of “techsimplyfy.pem” to 400 (Only current user can perform read operation) by using chmod 400 {full/path/to}/techsimplyfy.pem command. Once done then use following command to ssh to instance

ssh -i {full/path/to}/techsimplyfy.pem ec2-user@ec2-54-210-107-220.compute-1.amazonaws.com

It is always better to specify the full path to the private file “techsimplyfy.pem”.

Putty - 1

Since this will be the first time you are connecting to the instance, hence it will ask “Are you sure you want to continue connecting (yes/no) ?” Type yes to continue and add the host to the list of known hosts. Now you can start working on the server like any other Linux server.

Connecting to AWS Linux based Operating System via another Linux based operating system is relatively easy as compared to connecting via Windows based operating system. So let’s connect to our Instance using Windows based Operating System, but before we do, there are couple of application you need before you could connect to your instance.

Putty 32 bit 64 bit

Puttygen 32 bit 64 bit

Download Putty and Puttygen application. Run Puttygen.

PuttyGen - 1

Click on Load, browse to the “techsimplyfy.pem” and click on open.

PuttyGen - 2

The private file will be imported successfully. Click on OK.

PuttyGen - 3

Click on Save Private Key. Click on Yes to continue.

PuttyGen - 4

Browse the location where you can store the putty private file securely. I strongly recommend using the same name “techsimplyfy” in order to avoid any confusion. Click on save. Now you can close “puttygen”.

PuttyGen - 5

Run putty.

putty - 1

Enter “username@FQDN” i.e. “ec2-user@ec2-52-91-203-68.compute-1.amazonaws.com” under “Host Name(or IP address)”

 

putty - 2

In category section go to Connection > SSH > Auth. Under “Private key file for authentication”, browse the “techsimplyfy.ppk” which was created via Puttygen earlier. Once done click on “Open” to start the session, wait for some time and putty connects with instance and once done it gives you a console on that instance. You can now start working with the server.

Putty - 3

Click on “Yes” to add the Server’s host key into Putty’s cache registry.

Putty - 4

Well, that might be a bit complicated but it works well. Now let’s move on to connecting to Amazon Windows Server instance. Deploy a Windows Server Instance using the same steps mentions for Amazon Linux, once completed wait for at least 2 – 5 minutes because it takes approximately that much time for Amazon to generate password for Administrator account for your server.

Select the Windows instance in EC2 console. Go to Actions > Get Windows password.

Windows - 1

To retrieve the default Administrative password, pass the private file techsimplyfy.pem”, once it is loaded click on “Decrypt Password”

Windows - 2

Windows - 3

Make a note of Public DNS, Username and Password. Start the run window by clicking “Windows + R”, type “mstsc” and click on “ok”

Windows - 4

Enter the Hostname or Public DNS noted down earlier, Expand the Option by clicking on it. Enter “Administrator” as username and click on “Connect”

Windows - 5

 Enter Password and click on “ok”

Windows - 6

Windows - 7

Click on “Yes” to establish a trust relationship between the Amazon Windows Server and your local machine. Once done the windows instance will be loaded in a window and you can start working on it as if you are working on your PC.

Windows - 8

Well, that’s it for today. You can now play around the ec2 service, trying different flavors of Windows and Linux server but make sure that you are always under free tier limit. I hope you enjoyed it and most importantly learned something new here today. I’ll be back soon, next time we will go through the step by step implementation of one of the most important feature of Amazon EC2, Until then take care 🙂

 

2 thoughts on “Getting Started with AWS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s