HIDE

Grid

GRID_STYLE

Classic Header

{fbt_classic_header}

Header Ads

Breaking News

latest

Introduction to AWS and AWS EC2 (Elastic Compute Cloud) Services

Introduction to Amazon Web Services and AWS EC2 ·        Amazon Web Services (AWS) is a collection of remote computing services (web servi...

Introduction to Amazon Web Services and AWS EC2

Introduction to Amazon Web Services

·       Amazon Web Services (AWS) is a collection of remote computing services (web services) that together make up a cloud computing platform, offered over the Internet by Amazon.com.

·       Website: http://aws.amazon.com

·       AWS is located in 24 geographical 'Regions ‘. Each Region is wholly contained within a single country.

·       In 2006, Amazon Web Services (AWS) began offering IT infrastructure services to businesses as web services—now commonly known as cloud computing.

·       AWS was moved to amazon.com in 2010.


Characteristics of AWS

1.     Flexibility: The flexibility of AWS allows us to choose which programming models, languages, and operating systems are better suited for their project, so we do not have to learn new skills to adopt new technologies.

2.     Cost Effective: AWS provides no upfront investment, long-term commitment, or minimum spend. You can scale up or scale down as the demand for resources increases or decreases, respectively.

3.     Scalable and elastic: Scalability in AWS has the ability to scale the computing resources up or down when demand increases or decreases respectively. Elasticity in AWS is defined as the distribution of incoming application traffic across multiple targets such as Amazon EC2 instances, containers, IP addresses, and Lambda functions.

4.     Secure: AWS provides a scalable cloud-computing platform that provides customers with end-to-end security and end-to-end privacy. AWS provides a scalable cloud-computing platform that provides customers with end-to-end security and end-to-end privacy.


Elastic Compute Cloud (EC2) with Lab

Elastic Compute Cloud (EC2)

·       Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) cloud.

·       We can use Amazon EC2 to launch as many or as few Virtual Servers as we need, configure security, Networking and manage Storage.

·       Amazon EC2 enables us to Scale Up or Scale Down the Instances Capacity.

·       Preconfigured templates are available known as Amazon Machine Images.

·       By default, when we create an AWS account with amazon, our account is limited to a max of 20 instances per ec2 region with two default High I/O Instances

Types of EC2 Instances:

·       General Purpose:                                          Balanced Memory and CPU

·       Compute Optimized:                                   More CPU than Ram

·       Memory Optimized:                                    More Ram

·       Accelerated Computing/GPU:                    Graphics Optimized

·       Storage Optimized:                                      Low Latency

·       High Memory Optimized:                          High Ram, Nitro System 

EC2 Purchasing Options:

1) On-demand

2) Dedicated Instances

3) Schedule Instances

4) Reserved Instances (RI)

5) Dedicated Host

6) Spot Instances

·       There are three ways to pay for EC2 Instance i.e. On-Demand, Reserved Instance and Spot Instances.

·       Dedicated host and Dedicated instances costs are calculated as per On-Demand instance costs and Scheduled instances are billed as per reserved instance costs.

·       We can also pay for dedicated host which provides us with EC2 instance capacity on physical server dedicated for our use.

 

Some other information related to EC2

EC2 Access Data:

·       To access instances, we need a key and key pair name. We can download the private key only once.

·       The public key is saved by AWS to match it to the key pair name and private key when we try to login to the instance.

·       Without key pair we cannot access instances via RDP or SSH(Linux).

·       There is a 20 ec2 instances soft limit per region, and we can submit request to AWS to increase limit

EC2 Status Check:

·       By default, AWS EC2 instances performs automated status checks every 1 min.

·       This is done on every running EC2 instances to identify any H/W or software issues.

·       Status check is built into the AWS EC2 instance.

·       They cannot be configured, deleted, or disabled.

·       EC2 services can send its metric data to AWS CloudWatch every 5 min (enabled by default).

·       Enabled detailed monitoring is chargeable and sends metrics in every 1 min.

·       We are not charged for ec2 instances if they are stopped but attached EBS volumes get charged.

When we stop an EBS backed ec2 instance:

·       Instances perform a shutdown.

·       State changes from running to stopping.

·       EBS volumes remain attached to the instance.

·       Any data cached in ram or instance store volume is gone.

·       Instances retain its private IPv4 address and any IPv6 address.

·       Instances releases its public IPv4 address back to AWS pool

·       Instances retain its elastic IP addresses.

EC2 Terminate:  

·       When we terminate a running instance the instance state changes from running to shutting down and then to terminated.

·       During the shutting down and terminated states, we do not incur charges.

·       By default, EBS root devices volumes are deleted automatically when the ec2 instances are terminated.

·       Any additional (non-boot/boot) volumes attached to the instances by default, persist after the instances is terminated.

·       We can modify both behaviors by modifying the ‘delete on termination’ attribute of any EBS volumes during instances launch or while running.

·       Enable ec2 termination protection against accidental termination.

EC2 Metadata:

·       This is instance data that we can use to configure or manage the instance e.g : IPv4 addr, IPv6 addr, DNS hostname, AMI-Id, Instance id, instance type, local hostname, public keys, security groups.

·       Metadata can be only viewed from within the instance itself i.e we need to login to the instance.

·       Metadata is not protected by encryption, anyone that has access to the instance can view this data. To view instance metadata use, GET http://<IP Address>/latest/metadata

Instances User Data:

·       Data supplied by the user at instance launch in the form of a script to be executed during the instance boot and here the user data is limited to 16kb.

·       We can change user data by stopping ec2 first.

·       User data is not encrypted

EC2 Bare Metal Instances:

·       They are non-virtualized environment and operating Systems runs directly on hardware.

·       They are suitable for licensing restricted tier 1 business critical application like i3 metal, i5 metal, r5metal, z1d metal, u-6tb1.metal

Elastic Block Storage: EBS backed instance

·       We can easily replicate between availability zones with snapshots etc.

·       EBS volumes attached at launch are deleted when instance terminate.

·       EBS volumes attached to a running instance are not deleted when instance is terminated but are detached with data intact.

·       EBS is network attached storage.

Instance Storage: Instance backed storage

·       They are physically attached to the host server.

·       Data are not lost when OS is rebooted and is lost when underlying drive fails, instance is stopped or terminated.

·       We cannot attach or detach to another instance.

 

LAB PRACTICE FOR AWS EC2

How to launch windows machine in AWS EC2

Step 1: Login to AWS account (Steps have been shared above to create AWS account)

Step 2: Choose region which is nearby?  (Asia pacific - Mumbai)

Step 3: Go Services - EC2 - Launch Instance

Stage 1 - Select AMI (Note: Select free tier eligible) Win Server 2012

               Stage 2 - t2.micro  

               Stage 3   --No of instances - 1

               Stage 4 - Storage - 30GB (Observation - we have root - it is same as C Drive)

Stage 5 - Add Tag - Giving name to the machine

                                             Add Name Tag

                                             Value - <Put machine name here>

               Stage 6 - Security group - ( It deals with ports )

                                             We have 0 to 65535 ports. Every port is dedicated to special purpose

                                             RDP -- 3389

                                             SSH -- 22

                                             HTTP -- 80

                                             HTTPS - 443

               For windows machine, we need to open RDP port (Remote Desktop Protocol)

               Stage 7 -Just observe the warnings, just verify the options, Launch

Create a new keypair- download key pair - launch instance

We get the instance ID - View Instances

Now, the new windows machines are having its own DNS Name, Username and password

And we need to provide all the above 3 details in our laptop so that we can connect.

We use an application called Remote Desktop Connection

AWS, gives us DNS name and username but it does not give the password.

Instead of password, AWS has given us pem file. But, to connect to Window, we need password.

AWS gives an option to convert .pem to password

How to convert. pem to password:

Connect to instance - Get password - upload pem file – Decrypt

Now Open Remote Desktop on your computer

Provide DNS

Username - Administrator

Password – c<which you got after converting .pem file)

How to launch Linux machine in AWS EC2

Step 1: Login to AWS account (Steps have been shared above to create AWS account)

Step 2: Choose region which is nearby?  (Asia pacific - Mumbai)

Step 3: Go Services - EC2 - Launch Instance

AMI - Amazon Linux 2 - T2.micro - No of instance 1 - Tag – Linux machine -

Change security group (Security group name – Linux), Description - Linux (optional) -

Review launch -- Create new keypair -- download key pair - View Instances

We use putty tool to connect to Linux machine and putty required ppk file (Putty private key )

So, we need to convert .pem file to .ppk file for connecting to Linux machine.

We use puttygen to get the ppk file.

Download from google using the keywords "putty and puttygen"

Under alternate binary files

select putty.exe (64 bit)

select puttygen.exe (64 bit )

Open puttygen - load - Save private key -- Save key without passphrase ( Yes )  - Save

Credentials required for putty:

Hostname - username@dns    ( We get this from ssh command )

select SSH - Auth - Select ppk file using browse option - Open

 username - <We get this via SSH command>

Creating Web Server:

A Web server is a program that uses HTTP (Hypertext Transfer Protocol) to serve the files that from web pages to users in response to their request.

Example:

1) Apache HTTP Server

2) Internet Information Services (IIS)

3) Nginx

4) httpd by Apache

LAB - Creating Linux machine as Web Server:

Step 1: Create a Linux EC2 instance and launch

Step 2: Now install the web packages on Linux EC2 machine with below command:        

sudo su

yum update -y

yum install httpd -y

cd /var/www/html

echo "Mywebpage" > index.html

service httpd start

chkconfig httpd on

Now, Our Linux machine is webserver. Let us test are we able to access the web pages?

Copy the public IP and paste in browser.

Result: We are unable to access.

Note: Browser communicates using http port hence we should also open http port

Let us open http port:

IN AWS Dashboard, click on security groups

Select our security group (Security Group name) - Inbound - Edit - Add rule

Select Type - HTTP -- Save.

Observation: We get two entries for HTTP port. One for ipv4 and other for ipv6.

Now, let us test are we able to access the web pages?

Yes!!

No comments