Diwali Deal : Flat 20% off + 2 free self-paced courses + $200 Voucher  - SCHEDULE CALL

Top AWS EC2 Interview Questions and Answers

Introduction

AWS EC2 (Elastic Compute Cloud) is like renting virtual computers from Amazon's massive data centers. You can use these computers for various tasks like running apps, hosting websites, or processing data. For beginners in AWS interviews, understanding EC2 basics is crucial. It's an entry point to AWS services, showcasing skills in provisioning, managing, and scaling virtual servers. Our Amazon EC2 questions and answers for the AWS interview will help you learn about EC2's features, like different instance types and storage options, demonstrating a grasp of cloud computing fundamentals. 

Q1: What's The Difference Between Stopping And Starting An Amazon EC2 Instance Versus Terminating It?

A: When you stop an EC2 instance, you just temporarily put it on hold. It keeps all its settings and data, but it's not running. When you start it again, it picks up where it left off. Terminate, on the other hand, means shutting down the instance for good. You lose all its settings and data, which can't be undone.

Q2: Why Are Regions And Availability Zones Aritical In Amazon EC2?

A: Regions and Availability Zones let you choose where your EC2 instances are located geographically. You can spread them across different zones for better reliability. This setup helps build apps that can handle problems and provide fast services to users in different places.

Q3: What Happens When You Reboot An EC2 Instance?

A: Rebooting an EC2 instance is like giving it a quick restart. It keeps all its settings and data safe but gets a fresh start. It helps fix specific problems, install updates, or refresh the instance's environment.

Q4: What Is S3 And What Is It Used For?

A: Amazon Simple Storage Service (S3) is web storage designed for scalability, data availability, security, and performance. It is used for Storing and retrieving any amount of data from anywhere on the web, with a simple interface that makes web-scale computing easier for developers.

Q5: What Are Compute Basics In Amazon EC2?

A: Compute refers to the computational power required to fulfill your workload. If your workload is slight, such as a website receiving few visitors, your computing needs are minimal. A large workload, such as screening ten million compounds against a common cancer target, might require much computation. The amount of computing you need might change drastically over time.

Amazon EC2 allows you to acquire computing by launching virtual servers called instances. When you launch an instance, you can use the compute as you wish, just as you would with an on-premises server. Because you are paying for the computing power of the instance, you are charged per hour while the instance is running. When you stop the instance, you are no longer charged.

Q6: What Are Instance Types?

A: The instance type defines the virtual hardware supporting an Amazon EC2 instance. There are dozens of instance types available, varying in the following dimensions:

  • Virtual CPUs (vCPUs)

  • Memory

  • Storage (size and type)

  • Network performance

Instance types are grouped into families based on the ratio of these values to each other. For instance, the m4 family balances computing, memory, and network resources and is a good choice for many applications. Within each family, several choices scale up linearly in size.

Q7: What Are Amazon Machine Images (AMIs)?

A: The Amazon Machine Image (AMI) defines the initial software on an instance when it is launched. An AMI defines every aspect of the software state at instance launch, including:

  • The Operating System (OS) and its configuration

  • The initial state of any patches

  • Application or system software

All AMIs are based on x86 OSs, either Linux or Windows.

Q8: What Is Instance Metadata?

A: Instance metadata is data about your instance that you can use to configure or manage the running instance. This is unique in that it is a mechanism to obtain AWS properties of the instance from within the OS without making a call to the AWS API. An HTTP call to http://169.254.169.254/latest/meta-data/ will return the top node of the instance metadata tree. Instance metadata includes a wide variety of attributes, including:

  • The associated security groups

  • The instance ID

  • The instance type

  • The AMI used to launch the instance

Q9: What Are The Features Of Amazon EC2?

A:  The features of Amazon EC2 include: 

  • Bare Metal Instances: These give your apps direct access to the server's processor and memory. They're built on the Nitro system for high-performance networking and storage.

  • Pause and Resume Your Instances: You won't be charged for usage while your instance is hibernated, though storage incurs regular rates.

  • High I/O Instances: Ideal for high-performance databases and Elastic Search, they offer fast SSDs and high disk throughput.

  • Flexible Storage Options: Amazon EBS provides reliable, low-latency block storage volumes replicated within Availability Zones for high availability.

  • Elastic IP Addresses: Static IP addresses you control until you release them are handy for dynamic cloud computing.

  • Enhanced Networking: Offers better I/O performance and lower CPU usage than traditional setups. It is best used with HVM AMIs in VPC.

Q10: What Is The Use Of Termination Protection?

A:When an Amazon EC2 instance is no longer needed, the state can be set to Terminate, and the instance will be shut down and removed from the AWS infrastructure. To prevent termination via the AWS Management Console, CLI, or API, termination protection can be enabled for an instance. While enabled, calls to terminate the instance will fail until termination protection is disabled. This helps to prevent accidental termination through human error.

Note that this protects from the AWS Management Console, CLI, or API termination calls. It does not prevent termination triggered by an OS shutdown command, termination from an Auto Scaling group, or termination of a Spot Instance due to Spot price changes.

Q11: What Are The Different Tenancy Options?

A: Several tenancy options for Amazon EC2 instances can help customers achieve security and compliance goals.

Shared Tenancy– Shared tenancy is the default model for all Amazon EC2 instances, regardless of instance type, pricing model, etc. Shared tenancy means that a single host machine may house instances from different customers. This is a secure tenancy model because AWS does not use overprovisioning and fully isolates instances from other instances on the same host.

Dedicated Instances—Dedicated Instances run on hardware dedicated to a single customer. As a customer runs more Dedicated Instances, more underlying hardware may be dedicated to their account. Other instances in the account (those not designated as dedicated) will run on shared tenancy and be isolated at the hardware level from the Dedicated Instances in the account.

Q12: What Are Placement Groups?

A: A placement group is a logical grouping of instances within a single Availability Zone. It enables applications to participate in a low-latency, 10 Gbps network. Placement groups are recommended for applications that benefit from low network latency, high network throughput, or both. Remember that this represents network connectivity between instances. Choose an instance type that fully supports enhanced networking and 10 Gbps network performance to fully use this network performance for your placement group.

Q13: What Are The Encryption Options In Amazon EBS?

A: Many workloads require data encryption at rest, either because of compliance regulations or internal corporate standards. Amazon EBS offers native encryption on all volume types.

When you launch an encrypted Amazon EBS volume, Amazon uses the AWS Key Management Service (KMS) to handle key management. A new master key will be created unless you select a master key that you created separately in the service. Your data and associated keys are encrypted using the industry-standard AES-256 algorithm. 

The encryption occurs on the servers that host Amazon EC2 instances, so the data is actually encrypted in transit between the host and the storage media and also on the media. Encryption is transparent, so all data access is the same as unencrypted volumes, and you can expect the same IOPS performance on encrypted volumes as you would with unencrypted volumes, with a minimal effect on latency. Snapshots taken from encrypted volumes are automatically encrypted, as are volumes created from encrypted snapshots.

Q14: What Are The Sources Of Amazon Machine Images (AMIs)?

A: There are four sources of AMIs:

Published by AWS—AWS publishes AMIs with versions of many different OSs, both Linux and Windows. These include multiple distributions of Linux (including Ubuntu, Red Hat, and Amazon's distribution) and Windows 2008 and 2012. Launching an instance based on one of these AMIs will result in the default OS settings, similar to installing an OS from the standard OS ISO image. As with any OS installation, you should immediately apply all appropriate patches upon launch.

The AWS Marketplace—AWS Marketplace is an online store that helps customers find, buy, and immediately start using the software and services that run on Amazon EC2. Many AWS partners have made their software available in the AWS Marketplace. This provides two benefits: the customer does not need to install the software, and the license agreement is appropriate for the cloud. Instances launched from an AWS Marketplace AMI incur the standard hourly cost of the instance type plus an additional per-hour charge for the additional software (some open-source AWS Marketplace packages have no additional software charge).

Generated from Existing Instances—An AMI can be created from an existing Amazon EC2 instance. This is a prevalent source of AMIs. Customers launch an instance from a published AMI configured to meet all the customer's corporate standards for updates, management, security, and so on. An AMI is then generated from the configured instance and used to generate all instances of that OS. In this way, all new instances follow the corporate standard, making it more difficult for individual projects to launch non-conforming instances.

Uploaded Virtual Servers—Using AWS VM Import/Export service, customers can create images from various virtualization formats, including raw, VHD, VMDK, and OVA. The current list of supported OSs (Linux and Windows) can be found in the AWS documentation. It is incumbent on the customers to remain compliant with the licensing terms of their OS vendor

Q15: What Are Some Ways To Address Instances?

A: There are several ways that an instance may be addressed over the web upon creation:

Public Domain Name System (DNS) Name—When you launch an instance, AWS creates a DNS name that can be used to access the instance. This DNS name is generated automatically and cannot be specified by the customer. The name can be found in the Description tab of the AWS Management Console or via the Command Line Interface (CLI) or Application Programming Interface (API). This DNS name persists only while the instance runs and cannot be transferred to another instance.

Public IP—A launched instance may also have a public IP address assigned. This IP address is assigned from the addresses reserved by AWS and cannot be specified. It is unique on the Internet, persists only while the instance runs, and cannot be transferred to another instance.

Elastic IP—An elastic IP address is an address unique on the Internet that you reserve independently and associate with an Amazon EC2 instance. While similar to a public IP, there are some key differences. This IP address persists until the customer releases it and is not tied to the lifetime or state of an individual instance. Because it can be transferred to a replacement instance in the event of an instance failure, it is a public address that can be shared externally without coupling clients to a particular instance.

Q16: What Is The Process Of Providing Code To Be Run On An Instance Called?

A: A great benefit of the cloud is the ability to script virtual hardware management in a manner impossible with on-premises hardware. To realize this value, there has to be some way to configure instances and install applications programmatically when an instance is launched. The process of providing code to be run on an instance at launch is called bootstrapping.

When an instance is launched, a string value called UserData is one of the parameters. This string is passed to the operating system to be executed as part of the launch process the first time the instance is booted. This can be a shell script; on Linux instances and Windows instances, this can be a batch-style or PowerShell script. The script can perform tasks such as:

  • Applying patches and updates to the OS

  • Enrolling in a directory service

  • Installing application software

  • Copying a more extended script or program from storage to be run on the instance

  • Installing Chef or Puppet and assigning the instance a role so the configuration management software can configure the instance

Q17: How Can You Modify An Instance?

A: Several aspects of an instance can be modified after launch. 

Instance Type—The ability to change an instance's instance type contributes greatly to the agility of running workloads in the cloud. Instead of committing to a certain hardware configuration months before a workload is launched, the workload can be launched using the best estimate for the instance type. If the computer needs to prove to be higher or lower than expected, the instances can be changed to a different size that is more appropriate to the workload.

Instances can be resized using the AWS Management Console, CLI, or API. To resize an instance:

  1. Set the state to Stopped.

  2. Choose the "Change Instance Type" function in the tool of your choice (the instance type is listed as an Instance Setting in the console and an Instance Attribute in the CLI) and select the desired instance type.

  3. Restart the instance, and the process will be complete.

Security Groups– If an instance runs in an Amazon VPC, you can change which security groups are associated with an instance while the instance is running. For instances outside of an Amazon VPC (EC2-Classic), the association of the security groups cannot be changed after launch.

Q18: What Are The Pricing Options Available In Amazon EC2 Instances?

A: You are charged for Amazon EC2 instances for each hour they are running, but the amount you are charged per hour can vary based on three pricing options: On-Demand Instances, Reserved Instances, and Spot Instances.

On-Demand Instances– The price per hour for each instance type published on the AWS website represents the price for On-Demand Instances. This is the most flexible pricing option, as it requires no up-front commitment, and the customer has control over when the instance is launched and when it is terminated. It is the least cost-effective of the three pricing options per compute hour. Still, its flexibility allows customers to save by provisioning a variable level of computing for unpredictable workloads.

Reserved Instances– The Reserved Instance pricing option enables customers to make capacity reservations for predictable workloads. Using Reserved Instances for these workloads, customers can save up to 75 percent over the on-demand hourly rate. When purchasing a reservation, the customer specifies the instance type and Availability Zone for that Reserved Instance and achieves a lower effective hourly price for that instance for the reservation duration. An additional benefit is that capacity in the AWS data centers is reserved for that customer. 

Spot Instances– For workloads that are not time-critical and are tolerant of interruption, Spot Instances offer the most significant discount. With Spot Instances, customers specify the price they are willing to pay for a specific instance type. When the customer's bid price exceeds the current Spot price, the customer will receive the requested instance(s). These instances will operate like all other Amazon EC2 instances, and the customer will only pay the Spot price for the hours that instance(s) run. The instances will run until:

  • The customer terminates them.

  • The Spot price goes above the customer's bid price.

  • There is not enough unused capacity to meet the demand for Spot Instances.

If Amazon EC2 needs to terminate a Spot Instance, the instance will receive a termination notice providing a two-minute warning before Amazon EC2 terminates the instance.

Q19: What Are Instance Stores?

A: An instance store (sometimes called ephemeral storage) provides temporary block-level storage for your instance. This storage is located on disks physically attached to the host computer. An instance store is ideal for temporarily storing information that changes frequently, such as buffers, caches, scratch data, and other temporary content, or for data replicated across a fleet of instances, such as a load-balanced pool of web servers. 

The size and type of instance stores available with an Amazon EC2 instance depend on the type. At this writing, storage with various instance types ranges from no instance stores to 24 2 TB instance stores. The instance type also determines the type of hardware for the instance store volumes. While some provide Hard Disk Drive (HDD) instance stores, other instance types use Solid State Drives (SSDs) to deliver very high random I/O performance.

Instance stores are included in the cost of an Amazon EC2 instance, so they are a very cost-effective solution for appropriate workloads. The critical aspect of instance stores is that they are temporary. Data in the instance store is lost when:

  • The underlying disk drive fails.

  • The instance stops (the data will persist if an instance reboots).

  • The instance terminates.

Q20: What Is A General-Purpose SSD?

A: General-purpose SSD volumes offer cost-effective storage ideal for a broad range of workloads. They deliver strong performance at a moderate price point that is suitable for various workloads.

A general-purpose SSD volume can range from 1 GB to 16 TB and provides a baseline performance of three IOPS per gigabyte provisioned, capped at 10,000 IOPS. For instance, if you provision a 1 TB volume, you can expect a baseline performance of 3,000 IOPS. A 5 TB volume will not provide a 15,000 IOPS baseline; it would hit the cap at 10,000 IOPS.

General-purpose SSD volumes under 1 TB can also burst to 3,000 IOPS for extended periods. For instance, if you have a 500 GB volume, you can expect a baseline of 1,500 IOPS. Whenever you are not using these IOPS, they are accumulated as I/O credits. 

When your volume has heavy traffic, it will use the I/O credits at a rate of up to 3,000 IOPS until they are depleted. At that point, your performance reverts to 1,500 IOPS. At 1 TB, the baseline performance of the volume is already at 3,000 IOPS, so bursting behavior does not apply.

General-purpose SSD volumes are billed based on the amount of data space provisioned, regardless of how much data you store on the volume. They are suited for a wide range of workloads where the very highest disk performance is not critical, such as:

  • System boot volumes

  • Small- to medium-sized databases

  • Development and test environments

    AWS Solution Architect Training and Certification

    • Personalized Free Consultation
    • Access to Our Learning Management System
    • Access to Our Course Curriculum
    • Be a Part of Our Free Demo Class

Conclusion

JanBask Training's AWS courses are tailored to equip beginners with comprehensive knowledge of Amazon EC2 and other AWS services. These courses cover EC2 essentials, including instance types, storage options, and networking features, in a beginner-friendly manner. Moreover, these courses provide expert guidance and support, helping beginners prepare for AWS interviews with confidence

Trending Courses

Cyber Security

  • Introduction to cybersecurity
  • Cryptography and Secure Communication 
  • Cloud Computing Architectural Framework
  • Security Architectures and Models

Upcoming Class

4 days 22 Nov 2024

QA

  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing

Upcoming Class

14 days 02 Dec 2024

Salesforce

  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL

Upcoming Class

2 days 20 Nov 2024

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum

Upcoming Class

5 days 23 Nov 2024

MS SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design

Upcoming Class

5 days 23 Nov 2024

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning

Upcoming Class

4 days 22 Nov 2024

DevOps

  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing

Upcoming Class

-0 day 18 Nov 2024

Hadoop

  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation

Upcoming Class

4 days 22 Nov 2024

Python

  • Features of Python
  • Python Editors and IDEs
  • Data types and Variables
  • Python File Operation

Upcoming Class

12 days 30 Nov 2024

Artificial Intelligence

  • Components of AI
  • Categories of Machine Learning
  • Recurrent Neural Networks
  • Recurrent Neural Networks

Upcoming Class

5 days 23 Nov 2024

Machine Learning

  • Introduction to Machine Learning & Python
  • Machine Learning: Supervised Learning
  • Machine Learning: Unsupervised Learning

Upcoming Class

39 days 27 Dec 2024

Tableau

  • Introduction to Tableau Desktop
  • Data Transformation Methods
  • Configuring tableau server
  • Integration with R & Hadoop

Upcoming Class

4 days 22 Nov 2024