DEV Community

jhaji12 for AWS Community Builders

Posted on • Updated on

EC2 - Elastic Compute Cloud

Elastic Compute Cloud is a web service by AWS which provides scalable computing capacity. Here Computing refers to processing power, memory, networking, storage, and other resources. It offers infrastructure as a service(IaaS).

Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. It is highly scalable and pay-as-you-go model.

Benefits of EC2 -

Image description

Features of EC2 -

  • Instances - It is a virtual server for running applications on AWS infrastructure.

  • AMI - Amazon Machine Image is a template that provides information required to launch instances.

  • Instance types - Amazon EC2 provides a total of 8 instance types which are classified according to their use cases. Instance types comprise varying combinations of CPU, memory, storage and networking capacity to give the client a flexibility to choose the appropriate mix of resources for your applications.

  • Secure Login - It allow secure login for your instances using key-pairs.

  • Regions and Availability Zones - It is a physical location around the world where data centers are clustered. Each group of logical data centers are called Availability Zone.

  • VPCs(Virtual Private Clouds) - It enables you to launch AWS resources into a virtual network that you've defined.

Amazon Machine Image

An Amazon Machine Image (AMI) is a template/prototype that contains a software configuration (for example, an operating system, server, and applications). From an AMI we can launch an instance, which is a copy of the AMI running as a virtual server in the cloud.
It includes EBS, Launch permissions, a block device mapping that specifies the volumes to attach to the instance when it's launched.

Image description

In the below diagram, it shows how we can create and register an AMI which includes EBS snapshot or template that can be used to launch new instance or to create another copy of AMI within same region or different AWS region. If we want any changes then we can deregister AMI and then launch it again.

Image description

In simple words AMI is a base image(it can include different OS) using which we can launch instances.

Creating an EC2 Instance - Hands on

  • Open the Amazon EC2 console at click here

  • To launch an instance click on ec2
    Image description

  • Click on instances to see the instances and their running status

Image description

  • If there is no instance created you will see this

Image description

  • Click on new Launch instances and then it will show you all the AMIs that are available for different use cases. We will select windows (Microsoft Windows Server 2019 Base - ami-0f9a92942448ac56f) to launch an instance of windows OS.

Image description

  • On choosing the AMI, you will select the instance type according to your usage of CPU, RAM, Storage, bandwidth, if you are having free tier then only t2.micro is available.

Image description

  • Then you will choose the number of instances to be created from the AMI which is the configure instance details, this is the part where you can choose if you want to create a VPC.

Image description

  • Add Storage - Here you will decide the size and volume type according to your requirements.

Image description

  • Add Tags - We can add tags for our convenience it will be easier to identify and manage our instances like name, department, etc.

Image description

  • Configure Security group - Here we can decide how we want to access our instances, we can choose the protocol type(RDP,HTTP, HTTPS, SSH). RDP stands for Remote Desktop Protocol which will allow us to create remote desktop for windows. We can also decide who can access our instance. As you will see this warning

Rules with source of allow all IP addresses to access your instance. We recommend setting security group rules to allow access from known IP addresses only.

Image description

  • Review and Launch will allow you to check your instance launch details. You can go back to edit changes for each section. Click Launch to assign a key pair to your instance and complete the launch process.

  • On clicking launch, AWS asks for a key which you download and use to access via RDP download and keep the key safe as it only can be downloaded once. You can also select a previous key if you have a key generated already.

Image description

  • As you can see your instance is in running state, Select the instance you want to connect and click on connect button

Image description

  • Download the remote desktop file

Image description

  • Click on get password which you will need while login to the Remote desktop. Now upload the download .pem file or the key pair value that you have generated while launching the instance.

Image description

  • After uploading click on decrypt password and copy the password so that you can use it to login the Remote Desktop Connection.

Image description

  • Go to the downloaded remote desktop file and use the password to login. Here you go with the remote desktop connection, create your application and it is totally independent from your personal computer having it's own property.

Likewise you can create an instance for different AMIs.

Image description

  • If you want to create a template of your instance then stop the instance from running and then you can create templates of launched instances.

Image description

  • Likewise, you can create an image of your instance to launch another instance using your saved image(my AMIs) instead of using AMI. Image description

That's all for this blog.
Next I will be creating a blog on Instances and their types.

Top comments (0)