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
- Select EC2 - Manage tags- add tags
- 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?
You can connect with EC2 instance connect directly without key
You can create AMI using this default EC2 instance, and make new EC2 instance and create new key pair while creating EC2 instance
Take backup of EC2 instance, and while restoring, we can create new key pair value while creating another EC2 instance
For safe side store, key in secure place, or take it on email
- AD (Active Directory) -
AD is directory service developed MS.
Features
Centralized management - (Users, Computers and resources)
Authentication - Access (username/pwd)
Authorization - Permissions
Group Policy -
Q.3 Ways to login into EC2 machine?
Using pem file
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?
- Select EC2 - Actions - Instance setting - Change instance type
- 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?
- Select EC2 - Instance settings - Change termination protection
- Select enable and Save
- EC2 instance will not be able to delete
Q.7 How to remove termination protection?
- Select EC2 - Instance settings - Change termination protection
- 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:
Console
AWS CLI
Terraform
CloudFormation
• AWS CLI -> Follow steps below to create instance using AWS CLI
Download and install aws cli from internet
Restart your system
cmd -> aws configure
Account - security credentials - create Access key - paste credentials on cli
Search how to create EC2 using aws cli
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
Make necessary changes to above command like ami, key pair, default security group, any subnet
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
EC2 instance is created on aws.
awsz configure list
Q.9 What are 2/2 Checks on EC2 machine?
- 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.
- 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-
- 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.
- 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.
- 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.
- 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.
- 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
When user send request to www.flipkart.com, it goes to the DNS of the server.
DNS send this request to nginx.
Nginx will send request to region 1, if region 1 is not available it will send request to region 2.
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