DEV Community

Cover image for What is EC2 instance and Setup of EC2 instances.
Ashutosh Mallick
Ashutosh Mallick

Posted on

What is EC2 instance and Setup of EC2 instances.

WHAT IS AN EC2 INSTANCE?

  • Amazon EC2 stands for Amazon Elastic Compute Cloud.
  • Cloud service providers like AWS, Azure and GCP etc. use hypervisors in their physical servers to virtualize it.
  • EC2 instances are virtual machines (VMs) using those Hypervisors.
  • EC2 provides scalable computing capacity in the AWS Cloud and eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. -EC2 helps to launch as many virtual servers as you need, configure security and networking, and manage storage.
  • EC2 provides a wide range of instance types optimized to fit different use cases.
  • Instances are virtual servers and have varying combinations of CPUs, memory storage and networking capacity.

FEATURES OF EC2 INSTANCE

• Virtual computing environments, known as instances AND Preconfigured templates for your instances, known as Amazon Machine Images Or AMIs.
• Various configurations of CPU, memory, storage, and networking capacity for your instances, known as instance types.
• Secure login information for your instances using key pairs (AWS stores the public key, and you store the private key in a secure place)
• Storage volumes for temporary data that's deleted when you stop, hibernate, or terminate your instance, known as instance store volumes.
• Persistent storage volumes for your data using Amazon Elastic Block Store (Amazon EBS), known as Amazon EBS volumes.
• Multiple physical locations for your resources, such as instances and Amazon EBS volumes, known as Regions and Availability Zones.
• A firewall that enables you to specify the protocols, ports, and source IP ranges that can reach your instances using security groups.
• Metadata, known as tags, that you can create and assign to your Amazon EC2 resources.

SETUP OF EC2 INSTANCE

Image description

  • Step-2: In the navigation panel select EC2 service. On EC2 dashboard select instances from the left panel then click on launch instance.

Image description
-Step-3: Select an AMI from the list of various AMIs like( Amazon AMI, Linux AMI, Red hat AMI, Windows Server AMI etc.), let's select Amazon AMI.

Image description

  • Step-4: Select an Instance type from the list of instances, let's use "t2.micro" as it is eligible for free tier.

Image description
-Step-5: Configure instance details such as no. of instances you want to run or specify VPC network or Subnet. Here I've kept the specifications as default.

Image description

  • Step-6: Add storage for your instance as per your requirement or you can select the default root volume. Image description -Step-7: Add tags for your instance. A tag consists of a case-sensitive key-value pair. you could define a tag with key=Name and value = Webserver .A copy of a tag can be applied to volumes, instances or both. Image description -Step-8: Configure security groups. security group is a set of firewall rules that control the traffic for your instance. you can add rules to allow specific traffic to your instance. If you want to set up a web server and allow Internet traffic to reach your instance, add rules that allow unrestricted access to the HTTP and HTTPS ports. You can create a new security group or select from an existing one.

Image description
-Step-9: Review Instance Launch.
You can Cancel Previous Launch, review your instance launch details, go back to edit changes for each section. Click Launch to assign a key pair to your instance and complete the launch process. Don't forget to download your key pair file.
Image description
-Step-10: If your instance is successfully launched you can see Green check mark with instance state as "Running" and status as "2/2 checks passed" respectively.
Image description

  • Step-11: You can connect your instance using public DNS of your instance via SSH client using command prompt or Xshell or using PUTTY/PUTTYGEN. Here I've shown how to connect your instance using Xshell. First Install XSHELL from this link: https://www.netsarang.com/en/free-for-home-school/
  • paste your Public DNS in Xshell prompt and click accept. Then select Browse and select your private key pair file and open it. Your instance will now be connected via SSH.

Image description

Image description

We can also perform the above steps for an windows server instance using RDP client.
Image description
-After launching the instance select RDP client and download the RDP file. Then generate password and decrypt the password.
Image description

Image description
-Now open the RDP file and login using the decrypted password. When you connect you will be redirected to the remote desktop server and you can can connect your instance remotely.

  • Finally terminate the instance you have created otherwise you'll end up with bills from AWS.

Image description
Image description

Thank you :)

Top comments (0)