AWS EC2 Made Easy: Important Concepts and Questions

AWS EC2 Made Easy: Important Concepts and Questions

Q.1 If you forgot to take backup of EC2 machine and it will get corrupt, what will you do?

Answer: Tags -> More information about your EC2 machine

We take backup of EC2 machines having YES tag only

  1. Select EC2 - Manage tags- add tags

  1. You can check tags table below

Tags are added while creating EC2 machine only

We can change tags as per requirements from NO to YES and vice versa

We can skip including resources in backup strategy instead use tag policy

eg EC2 having YES tag will be taken for backup

Q.2 What if you lost key?

  1. You can connect with EC2 instance connect directly without key

  2. You can create AMI using this default EC2 instance, and make new EC2 instance and create new key pair while creating EC2 instance

  3. Take backup of EC2 instance, and while restoring, we can create new key pair value while creating another EC2 instance

  4. For safe side store, key in secure place, or take it on email

  • AD (Active Directory) -

AD is directory service developed MS.

Features

  1. Centralized management - (Users, Computers and resources)

  2. Authentication - Access (username/pwd)

  3. Authorization - Permissions

  4. Group Policy -

Q.3 Ways to login into EC2 machine?

  1. Using pem file

  2. If your AD(active directory) group is added in EC2 machine and domain is attached to it, you can login through your credentials

username - ssh ram@dns

Password- ram@426157

Q.4 How to resize EC2 instance?

  1. Select EC2 - Actions - Instance setting - Change instance type

  1. Select desired instance type and save

Q.5 What are important EC2 servers?

Active Directory servers, Domain servers, Info blocks , serviceNow servers

So we apply deletion protection on it.

Q.6 How to apply deletion protection on EC2?

  1. Select EC2 - Instance settings - Change termination protection

  1. Select enable and Save

  1. EC2 instance will not be able to delete

Q.7 How to remove termination protection?

  1. Select EC2 - Instance settings - Change termination protection

  1. Uncheck Enable and Save

PEM file -

  • ASCII text format

  • -----BEGIN RSA PRIVATE KEY---

  • Can be converted to other format like ppk

PPK file -

  • Useful for Putty

  • Putty Privatf Key

  • Can be generated from pem file using putty tool

Q8. How to create EC2 instance?

There are 4 ways to create EC2 instance as below:

  1. Console

  2. AWS CLI

  3. Terraform

  4. CloudFormation

    AWS CLI -> Follow steps below to create instance using AWS CLI

    1. Download and install aws cli from internet

    2. Restart your system

    3. cmd -> aws configure

    4. Account - security credentials - create Access key - paste credentials on cli

    5. Search how to create EC2 using aws cli

    6. aws ec2 run-instances --image-id ami-xxXXXxxx --count 1 --instance-type t2.micro --key-name MyKeyPair --security-group-ids sg-903004f8 --subnet-id subnet-6e7f829e

    7. Make necessary changes to above command like ami, key pair, default security group, any subnet

    8. aws ec2 run-instances --image-id ami-04a81a99f5ec58529 --count 1 --instance-type t2. micro --key-name batch-24 --security-group-ids sg-0397efb10aa82fab6 --subnet-id subnet-028a27bafe6822c42

    9. EC2 instance is created on aws.

    10. awsz configure list

Q.9 What are 2/2 Checks on EC2 machine?

  1. System Check -

This check is for proper hardware configuration of the instance at the host level.

These are managed by AWS. If this check fails you can simply stop and start instance.

  1. Instance Check -

This check is done to check software (OS) level configuration of the instance.

If this check fails then you will need to check either user data/launch configuration AMI/OS.

Q10. When you restart or stop EC2 machine private ip doesn’t change but public Ip gets change?

Why and how to prevent it?

Ans: We get Private IP from respective subnet hence it doesn’t change

We can prevent public IP from changing frequently by Using elastic IP address

• EC2 Instance Families-

  1. General Purpose Instances (e.g., t2, t3, m5) -

These instances provide a balance of compute, memory, and network resources. They are suitable for a wide range of workloads, including web servers, small databases, and development environments.

  1. Compute Optimized Instances (e.g., c5, c6g) -

These instances are designed for computationally intensive workloads that require high performance processors. They are suitable for applications such as scientific modeling, gaming servers, and high-performance web servers.

  1. Memory Optimized Instances (e.g., r5, x1e) -

These instances are optimized for memory-intensive workloads that require high memory capacity. They are suitable for applications like in-memory databases, real-time big data analytics, and high-performance computing.

  1. Storage Optimized Instances (e.g., i3, d2) -

These instances are designed for applications that require high-speed, low-latency storage. They are suitable for data warehousing, distributed file systems, and large-scale analytics.

  1. Accelerated Computing Instances (e.g., p3, g4) -

These instances are equipped with specialized hardware accelerators such as GPUs (Graphics Processing Units) or FPGAs (Field-Programmable Gate Arrays). They are suitable for tasks like machine learning, data processing, and video encoding.

  • Disaster Recovery

  1. When user send request to www.flipkart.com, it goes to the DNS of the server.

  2. DNS send this request to nginx.

  3. Nginx will send request to region 1, if region 1 is not available it will send request to region 2.

  4. Region 2 is replica of region 1.

This process is performed in Disaster recovery.

RPO - (Recovery point objective)

The max amount of data loss acceptable in disaster.

4 Hours

RTO - (Recovery Time Objective)

The max time allowed to restore IT systems after disaster.

8 Hours