AWS Interview Questions
What is EC2?
EC2 is Amazon’s IaaS (Infrastructure as a Service) product that allows users to rent virtual servers (instances) on-demand, run applications, and scale their infrastructure as needed.
What are the different types of EC2 instances?
EC2 instances come in various types such as General Purpose (e.g., t2, t3), Compute Optimized (e.g., c5), Memory Optimized (e.g., r5), Storage Optimized (e.g., i3), and GPU instances for compute-heavy tasks.
What is an EC2 instance type, and how do you choose the right one?
EC2 instance types define the specifications (CPU, memory, storage) of an instance. The right instance depends on your workload’s resource needs—compute, memory, or storage requirements.
What is an AMI (Amazon Machine Image)?
An AMI is a pre-configured template for EC2 instances that includes the OS, application server, and applications. It’s used to launch instances with a specific configuration.
What is the difference between stopping and terminating an EC2 instance?
Stopping an EC2 instance keeps the data in the EBS volume intact and you can restart it later. Terminating an instance deletes the instance and any attached storage (unless otherwise configured).
Explain EC2 pricing models.
C2 has several pricing models: On-Demand (pay by the hour or second), Reserved Instances (up to 75% discount for long-term usage), Spot Instances (up to 90% discount for unused EC2 capacity), and Dedicated Hosts (for compliance requirements).
How do you secure EC2 instances?
You can secure EC2 instances by setting up security groups (firewall rules), using IAM roles for permissions, encrypting EBS volumes, using key pairs for SSH, and keeping software updated.
What are security groups in EC2?
Security groups act as virtual firewalls for your instances to control inbound and outbound traffic based on IP, port, and protocol.
What are EC2 placement groups?
EC2 placement groups are used to control how instances are placed on underlying hardware. Types include Cluster (low-latency), Spread (high availability), and Partition (reduces failure risk by spreading across partitions).
What is Auto Scaling in EC2?
Auto Scaling automatically adjusts the number of EC2 instances in response to traffic or load. It ensures that the number of instances dynamically increases or decreases based on demand.
What is Amazon S3?
Amazon S3 is a scalable object storage service used to store and retrieve any amount of data at any time from anywhere on the web. It’s highly durable, scalable, and secure.
What are S3 buckets?
Buckets are containers for storing objects (data) in S3. Each object within a bucket has a unique key (name) within the bucket, and you can configure permissions at the bucket level.
What is the maximum file size you can upload to S3?
The maximum size of an individual object is 5TB. For uploads larger than 5GB, you must use multipart upload.
Explain S3 storage classes.
S3 offers several storage classes including Standard (frequently accessed data), Standard-IA (infrequent access), One Zone-IA (infrequent, less critical), Glacier (archiving), and Glacier Deep Archive (long-term storage).
How does S3 versioning work?
S3 versioning maintains multiple versions of an object within a bucket, allowing you to restore, retrieve, or revert to previous versions of the object.
What is S3 Transfer Acceleration?
S3 Transfer Acceleration speeds up the upload of large files by using Amazon CloudFront’s globally distributed edge locations to improve transfer speeds across geographical distances.
How do you secure data stored in S3?
Data in S3 can be secured by encrypting data at rest (using SSE-S3, SSE-KMS, SSE-C) and in transit (using SSL/TLS), bucket policies, access control lists (ACLs), IAM policies, and enabling MFA Delete.
What is the difference between S3 and EBS?
S3 is object storage designed for scalability and distributed storage of data, whereas EBS is block storage used with EC2 for persistent storage of file systems, databases, and applications.
What is the durability and availability of S3?
S3 provides 99.999999999% (11 9s) durability and 99.99% availability for Standard storage.
How do you host a static website on S3?
You can host a static website by uploading HTML, CSS, and other assets to an S3 bucket and enabling website hosting in the bucket properties. You need to set the appropriate permissions to make the content public.
What is Amazon RDS?
Amazon RDS is a managed relational database service that supports various database engines like MySQL, PostgreSQL, MariaDB, Oracle, Microsoft SQL Server, and Amazon Aurora.
How does Amazon RDS handle backups?
RDS provides automated backups, enabling you to recover your database to any point within a retention period (up to 35 days). Manual snapshots can also be taken.
What are Read Replicas in RDS?
Read replicas are copies of your database that allow read-heavy workloads to be offloaded from the primary database, improving read performance and redundancy.
What is Multi-AZ in RDS?
Multi-AZ (Availability Zone) deployment automatically replicates your data across two different availability zones for failover support and enhanced availability.
How do you scale an RDS instance?
You can scale an RDS instance vertically by modifying the instance type (CPU, memory), or horizontally by using read replicas for read scaling.
What is Amazon Aurora?
Amazon Aurora is a fully managed relational database service compatible with MySQL and PostgreSQL that provides high performance and availability, often up to five times faster than standard MySQL.
What is RDS Performance Insights?
RDS Performance Insights provides real-time performance monitoring and troubleshooting for RDS databases. It helps you analyze database load and optimize queries.
How is data encrypted in RDS?
Data can be encrypted using AWS KMS, both at rest (on disk) and in transit (SSL/TLS). Encrypted RDS instances encrypt data on the underlying storage and all backups, snapshots, and read replicas.
How do you secure an RDS database?
Security in RDS can be achieved by using VPC (Virtual Private Cloud) to isolate your database, enabling encryption, using IAM roles, applying security groups, and restricting access with database-level authentication.
What are the differences between RDS and DynamoDB?
RDS is a relational database service that supports SQL databases, while DynamoDB is a fully managed NoSQL database service optimized for key-value and document data models, offering horizontal scaling without SQL constraints.
What are the different types of EC2 instances?
EC2 instances are categorized into various types based on their use cases:
- General Purpose (e.g., t3, m6g): Balance of compute, memory, and networking.
- Compute Optimized (e.g., c5, c6g): Optimized for compute-bound applications.
- Memory Optimized (e.g., r5, x1e): For memory-intensive workloads.
- Storage Optimized (e.g., i3, d2): High disk throughput.
- Accelerated Computing (e.g., p3, f1): For GPU and FPGA workloads.
Explain the concept of instance types and sizes.
Instance types define the hardware of the host machine used for your instance. Each instance type offers different compute, memory, and storage capabilities. Instance sizes (like t3.micro, t3.large) within each type provide flexibility based on the required capacity.
What is an Elastic IP in EC2?
-
- An Elastic IP is a static IPv4 address designed for dynamic cloud computing. It can be associated with any instance and allows for easier management of your EC2 instances as IP addresses remain constant even if instances are stopped or restarted.
What is the difference between stopping and terminating an EC2 instance?
-
- Stopping an EC2 instance shuts it down, but the instance is still available, and you can restart it later (you will be billed for storage). Terminating an instance deletes it, and you can no longer access it.
How can you scale EC2 instances?
-
- You can scale EC2 instances either vertically (increasing the size of the instance) or horizontally (adding more instances). For horizontal scaling, Auto Scaling groups can automatically adjust the number of instances based on the demand.
What are EC2 Reserved Instances?
Reserved Instances allow you to reserve capacity in advance and offer significant savings compared to On-Demand instances. You can choose between Standard and Convertible Reserved Instances.
What is EC2 Spot Pricing?
EC2 Spot Instances allow you to bid on spare AWS EC2 computing capacity at discounted rates compared to On-Demand pricing. However, AWS can terminate the instance when your bid falls below the current Spot price.
What is an EC2 Security Group?
A security group acts as a virtual firewall for your EC2 instances, controlling the incoming and outgoing traffic. You can define rules based on IP ranges and protocols (e.g., TCP, UDP).
What are S3 buckets?
-
- S3 buckets are containers in Amazon S3 where objects (files) are stored. Each bucket has a globally unique name and can contain any number of objects.
What is the difference between Standard Storage and Glacier Storage in S3?
S3 Standard Storage is for frequently accessed data, offering low-latency access. S3 Glacier and S3 Glacier Deep Archive are used for long-term archival with retrieval times of minutes to hours.
Explain S3 versioning.
S3 versioning allows you to store multiple versions of an object in the same bucket. It helps protect against accidental overwrites or deletions by keeping older versions of files.
What is S3 lifecycle management?
-
- S3 lifecycle policies allow you to automate the movement of objects between different storage classes (e.g., from Standard to Glacier) based on pre-defined rules or conditions, such as age or last access date.
How is data secured in Amazon S3?
-
- S3 offers multiple layers of security, including bucket policies, IAM policies, encryption (server-side and client-side encryption), and SSL/TLS for data in transit. S3 also supports access control lists (ACLs).
What are S3 access logs?
-
- S3 access logs are logs that record details about requests made to your S3 bucket. These logs can be used for monitoring and auditing access to your data.
What are pre-signed URLs in S3?
-
- Pre-signed URLs grant temporary, time-limited access to a specific S3 object without needing to make the object public. These URLs can be shared with others to provide controlled access.
What is Cross-Region Replication (CRR) in S3?
CRR automatically replicates data from one S3 bucket to another bucket in a different AWS region for improved durability, compliance, or disaster recovery purposes.
What are the benefits of using Amazon RDS?
-
- The benefits include automated backups, easy scalability, high availability with Multi-AZ, automated maintenance, and improved security with encryption and VPC integration
What is the difference between Multi-AZ and Read Replicas in RDS?
-
- Multi-AZ provides high availability by automatically replicating your database to another Availability Zone, while Read Replicas provide scalability by creating read-only copies of your database for load balancing
What is the purpose of automated backups in RDS?
Automated backups are daily backups of your database that AWS creates automatically. They allow you to restore your database to any point in time within the retention period (up to 35 days).
How do you scale an RDS instance vertically?
To scale an RDS instance vertically, you can change the instance type to one with more CPU, memory, or I/O capacity, depending on your application’s needs.
What is RDS Performance Insights?
Performance Insights provides performance monitoring and tuning tools for RDS instances, enabling you to identify and resolve performance bottlenecks in your database.
How does RDS encryption work?
RDS supports encryption at rest and in transit. For at-rest encryption, you can enable encryption for your database using AWS KMS (Key Management Service) to encrypt the underlying storage.
What is Amazon Aurora, and how does it differ from traditional RDS?
Amazon Aurora is a fully managed, MySQL- and PostgreSQL-compatible relational database that offers up to five times the performance of standard MySQL and three times that of PostgreSQL, with high availability and scalability.
What are RDS parameter groups?
-
- Parameter groups in RDS are configuration settings that control the behavior of the database engine. You can modify these parameters to tune your database performance
What are RDS event notifications?
RDS event notifications allow you to receive alerts when specific database events occur, such as failover, backup completion, or maintenance actions. You can configure notifications via Amazon SNS (Simple Notification Service).
What is a Virtual Private Cloud (VPC)?
A VPC is a virtual network dedicated to your AWS account, providing isolated networking for your resources. It allows you to configure your own IP address range, subnets, route tables, and gateways.
What are the main components of a VPC?
Key components include subnets, route tables, internet gateway, NAT gateway, security groups, network ACLs, and VPC peering.
What are subnets in a VPC?
Subnets are subdivisions within a VPC that allow you to group resources based on accessibility needs, either public or private.
What’s the difference between a public and a private subnet?
A public subnet has a route to the internet via an Internet Gateway, while a private subnet does not, allowing it to be used for internal-only resources.
How does an Internet Gateway work in a VPC?
An Internet Gateway allows communication between resources in the VPC and the internet. It is attached to the VPC and allows public IP addresses in public subnets to access the internet.
What is a NAT Gateway, and when would you use it?
A NAT Gateway allows instances in a private subnet to connect to the internet without exposing them to inbound traffic. It’s useful for updating software on private instances.
What are Security Groups in VPC?
Security Groups act as virtual firewalls at the instance level, controlling inbound and outbound traffic to resources based on defined rules.
How do Network ACLs differ from Security Groups?
Network ACLs operate at the subnet level and provide an additional layer of security. Unlike Security Groups, they are stateless, meaning outbound responses need to be explicitly allowed.
Can you explain VPC Peering?
VPC Peering allows two VPCs to communicate with each other directly over private IP addresses, providing a way to connect VPCs within or across regions.
What is a Route Table in VPC?
A route table directs network traffic within a VPC, specifying the paths for traffic to reach different destinations, like other subnets or external networks.
How many VPCs can you have per region in AWS?
By default, you can have 5 VPCs per AWS region, though this limit can be increased upon request.
What is a VPC Endpoint?
A VPC Endpoint enables private connections between your VPC and AWS services, keeping the traffic within the AWS network.
Explain the types of VPC Endpoints.
There are two types: Interface Endpoints (for services that use private IP addresses) and Gateway Endpoints (for S3 and DynamoDB access).
What are Elastic IPs, and when should they be used?
An Elastic IP is a static, public IP that can be associated with an instance or NAT Gateway, useful for applications that need consistent IPs.
How does DHCP work in a VPC?
AWS provides a DHCP option set for assigning DNS and other options to instances in a VPC automatically.
Can you explain the purpose of a Transit Gateway?
A Transit Gateway allows you to connect multiple VPCs and on-premises networks through a single gateway, simplifying large network architectures.
What is a Bastion Host?
A Bastion Host is a secure instance used to access instances in private subnets, typically configured with SSH or RDP.
How can you connect VPCs in different regions?
VPCs in different regions can be connected through VPC Peering or by using a Transit Gateway.
Explain PrivateLink.
PrivateLink allows secure access to services hosted in VPCs without exposing the services to the public internet.
What is VPC Flow Logs?
VPC Flow Logs capture IP traffic information for network interfaces, helping with security monitoring and troubleshooting.
How can VPC Flow Logs be useful for security?
Flow Logs provide visibility into IP traffic, allowing you to monitor suspicious activities or unauthorized access attempts.Flow Logs provide visibility into IP traffic, allowing you to monitor suspicious activities or unauthorized access attempts.
What are the VPC default components?
Default VPC includes a default subnet in each AZ, a route table, an internet gateway, and a default security group.
How does AWS Direct Connect relate to VPC?
AWS Direct Connect establishes a dedicated network connection from your on-premises to your AWS VPC, bypassing the public internet.
What is an Elastic Network Interface (ENI)?
An ENI is a virtual network interface that can be attached to an instance, providing multiple IPs or network interfaces.
Can you explain the concept of VPC CIDR?
CIDR (Classless Inter-Domain Routing) defines the IP address range for a VPC. For example, a VPC might have a CIDR block like 10.0.0.0/16.
What is a VPN Gateway in VPC?
A VPN Gateway connects your on-premises network to your AWS VPC through a secure, encrypted VPN connection.
Describe how a VPN connection works in AWS.
A VPN connection uses IPsec to establish an encrypted tunnel from your network to the VPC, securing data transmitted between locations.
Can you change a VPC’s CIDR after it’s created?
You cannot modify an existing CIDR block, but you can add secondary CIDR blocks to extend the IP range.
How many subnets can you create in a VPC?
The limit is 200 subnets per VPC by default, which can be increased if necessary.
How would you troubleshoot connectivity issues within a VPC?
Check security groups, network ACLs, route tables, VPC Flow Logs, and ensure the correct IP addresses are configured.
What’s the purpose of Route Propagation in VPC?
Route Propagation allows VPN or Direct Connect routes to be automatically propagated to the VPC’s route table, simplifying configuration.
Can you explain cross-account VPC peering?
Cross-account VPC peering allows VPCs in different AWS accounts to communicate as long as there’s mutual peering setup and route configurations.
What are the limitations of VPC Peering?
Peering does not support transitive peering, so traffic cannot route from one peered VPC to another indirectly.
What is the difference between an Internet Gateway and an egress-only Internet Gateway?
An egress-only Internet Gateway provides outbound-only access for IPv6 traffic, blocking incoming traffic for security.
How do you configure multiple IPs for an instance in VPC?
You can add secondary IP addresses by attaching an Elastic Network Interface (ENI) with multiple IP addresses.
What’s the difference between a Transit Gateway and VPC Peering?
Transit Gateway allows transitive routing between multiple VPCs and on-premises networks, whereas VPC Peering is direct and non-transitive.
How would you set up a high-availability NAT solution?
Deploy NAT Gateways in multiple Availability Zones (AZs) and update the route tables to direct traffic accordingly.
Can VPCs in different regions communicate via peering?
Yes, AWS supports inter-region VPC peering.
What are some security best practices for VPC?
Use private subnets, Security Groups, Network ACLs, VPC Flow Logs, least privilege IAM, and avoid wide-open access in security rules.
Explain multicast and its support in VPC.
Multicast is used for streaming data to multiple subscribers; AWS VPC does not natively support multicast, requiring alternative configurations like IPsec.
What is DNS Resolution in VPC?
AWS offers DNS resolution through Amazon-provided DNS and enables private DNS for internal resources.
What’s the purpose of a Route Table in a VPC?
A route table defines how traffic is directed within the VPC or to external networks.
How is cross-region VPC connectivity established?
Through inter-region VPC peering or Transit Gateway attachments across regions.
Can you explain default VPCs in AWS?
A default VPC is a pre-configured VPC provided in each region, allowing easy setup for users.
How do you extend a VPC's IP range?
You can add secondary CIDR blocks to the VPC.
What is a Local Zone, and how does it relate to VPC?
A Local Zone brings AWS resources closer to users, extending a VPC’s reach to specific geographic locations.
How does VPC inter-region latency impact applications?
Latency can affect performance; direct peering or Transit Gateways may be used to minimize latency.
What’s the difference between a public and Elastic IP?
Public IPs are automatically assigned and released, while Elastic IPs remain constant.
How does VPC integrate with IAM policies?
IAM policies control user permissions on VPC resources, ensuring least privilege access.
Explain the relationship between VPC and S3.
Access to S3 from VPC can be achieved through VPC Endpoints, enabling private access without public internet.