Top AWS Elastic Compute Cloud (Amazon EC2) Interview Questions(2021) | CodeUsingJava
















Top AWS EC2 Gateway Interview Questions(2021)

In this post we will look at AWS EC2 Interview questions. Examples are provided with explanation.
  1. What is Elastic Compute Cloud?
  2. What are EC2 Components?
  3. What are the Features of EC2?
  4. What is Amazon S3?
  5. What is EC2 Image Builder?
  6. What is Elastic Load Balancing?
  7. What are the components of ELB?
  8. What is Auto Scaling?
  9. What is Reserved Instances in AWS EC2?
  10. What are the categories of Reserved Instances in AWS?
  11. What are the different types of EC2 instances based on their costs?
  12. What are the types of AMI designs?
  13. How can we change key pair for ec2 instance?
  14. How do you add swap to an EC2 instance?
  15. How do we install Python 3 on an AWS EC2 instance?
  16. How to find Unused Amazon EC2 Security groups?


What is Elastic Compute Cloud?

AWS Elastic Compute Cloud(EC2) helps us by providing resizable compute capacity in the AWS Cloud.They are designed for the developers for complete control over web scaling and computing resources, alos provides Infrastructure as a Service (IaaS) to its consumers (IaaS).EC2 instances can be scaled up or down as per our requirement and can be launched in one or more geographical locations or regions, and Availability Zones (AZs).Every region comprises of several AZs in distinct locations, connected by low latency networks in the same region.

What are EC2 Components?

  • Operating System Support - EC2 helps in supporting multiple OS to pay additional licensing fees such as Red Hat Enterprise, SUSE Enterprise and Oracle Enterprise Linux, UNIX, Windows Server, etc.
  • Security - We can have control over the visibility of our AWS accounts and also allows us to create groups and place running instances into it as per the requirement.
  • Pricing - EC2 offers pricing options and also depends on the types of resources, applications and databases, by allowing the users for configuring the resources and also computing the charges.
  • Fault Tolerance - AWS EC2 helps the userss for accessing the resources for designing fault tolerance applications.
  • Migration - EC2 allows us for moving existing applications and this service suits the users those having large amount of data to move.

What are the Features of EC2?

  • Reliable - EC2 helps us by offering reliable environment where the instances is rapidly possible.
  • Designed for AWS Web Services - AWS EC2 helps by working with AWS Services such as Amazon S3, Amazon RDS, Amazon DynamoDB, and Amazon SQS.
  • Secure - EC2 works with AWS Virtual Private Cloud(VPC) for providing a secure and robust network to the resources.
  • Flexible Tools - EC2 also provides tools for developers for building failure applications and isolate themselves from common situations.
  • Inexpensive - EC2 can include multiple purchases like On-Demand Instances, Reserved Instances, Spot Instances, etc. which we can choose as per our requirement.

What is Amazon S3?

Amazon S3 is used for storing and retrieving any amount of data, anytime, from anywhere on the web.It is used by the developers as it gives access to the same highly scalable, reliable, fast, and inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites.

What is EC2 Image Builder?

AWS EC2 Image Builder helps in simplifying the building, testing, and deployment of the virtual machine and the container images are used in the AWS.It is offers no cost, the cost of the underlying AWS resources used for creating, storing, and sharing the images.

EC2


What is Elastic Load Balancing?

ELB(Elastic Load Balancing) helps in distributing incoming request traffic across the multiple AWS EC2 instances and results in achieving higher fault tolerance and also helps in detecting unfit instances and automatically reroutes traffic for fitting instances until the unfit instances have been restored in a round robin manner.

What are the components of ELB?

ELB consists of 3 components:
  • LOAD BALANCER - it consists in monitoring and handling the requests that are incoming through the internet.
  • CONTROL SERVICE - handles the capacity in response for the incoming traffic by adding and removing the load balancers.
  • SSL TERMINATION - it provides SSL termination that saves the CPU Cycles, encoding and decoding SSL within our EC2 instances attached to the ELB.

What is Auto Scaling?

Amazon Auto Scaling helps in automating the groups of different resources responding to change in demand, we can optimize availability, costs, or balance.It is a feature of cloud computing that helps in enabling organizations for scaling cloud services like server capacities that are based on defined situations like traffic ot utilization levels.

EC2


What is Reserved Instances in AWS EC2?

AWS RI allows us for saving the AWS EC2 usage costs, we can set attributes like instance type, platform, tenancy, Region, or Availability Zone (optional).The ability for adjusting the operating system types and tenancy agreements in the RI, it offers an optional capacity reservation.The attributes of an EC2 instance usage match the active RI, AWS billing aplies discounted rates.

What are the categories of Reserved Instances in AWS?

There are 3 catagories of RI in AWS:
Standard RIs - used in a steady stage.
Convertible RIs - allows us to adjust RI attributes as long as we create RI of equal or greater value in exchange.
Scheduled RIs - allows us for matching the capacity reservation to a recurring, predictable schedule that only takes a fraction of a day.


What are the different types of EC2 instances based on their costs?

The 3 types of EC2 instances are On-demand Instance, Spot Instance, Reserved Instance.

What are the common types of AMI designs?

The types of AMI are:
Fully Baked AMI
Just Enough Baked AMI
Hybrid AMI


How can we change key pair for ec2 instance?

/home/ec2-user/.ssh/authorized_keys
/home/ubuntu/.ssh/authorized_keys
/root/.ssh/authorized_keys


How do you add swap to an EC2 instance?

For swapping or adding extra place we need to use the following command:
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1


How do we install Python 3 on an AWS EC2 instance?

If we use this:
sudo yum list | grep python3

Installing is as easy as:
sudo yum install python34 python34-pip



How to find Unused Amazon EC2 Security groups?


comm -23  <(aws ec2 describe-security-groups --query 'SecurityGroups[*].GroupId'  --output text | tr '\t' '\n'| sort) <(aws ec2 describe-instances --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId' --output text | tr '\t' '\n' | sort | uniq)