AWS EC2 u0026 VPC Interview Questions Quiz Quiz

Explore essential AWS EC2 and Virtual Private Cloud (VPC) interview questions designed to assess your foundational knowledge of cloud infrastructure, networking components, instance types, and security settings. Strengthen your understanding of key AWS EC2 and VPC concepts with practical, beginner-friendly scenarios.

  1. Understanding EC2 Instance Types

    Which option best describes a use case for a compute-optimized EC2 instance type?

    1. Running web servers for static sites
    2. Hosting lightweight blogs
    3. Storing large volumes of data
    4. Handling high-performance computing tasks

    Explanation: Compute-optimized EC2 instances are designed for applications that require significant CPU power, such as high-performance computing tasks. Running web servers for static sites or lightweight blogs typically requires less CPU, making general-purpose instances better suited. Storing large volumes of data is ideal for storage-optimized instances. Compute-optimized instances are not intended for storage-heavy or low-resource tasks.

  2. Purpose of Security Groups

    What is the primary function of a security group in a virtual private cloud environment?

    1. Encrypting data at rest
    2. Scaling resources automatically
    3. Monitoring network performance
    4. Defining inbound and outbound traffic rules

    Explanation: A security group acts as a virtual firewall to control inbound and outbound traffic to resources. It does not handle encryption of data at rest, as this is managed separately. Automatic resource scaling is typically managed by another service, and network performance monitoring involves different tools. Security groups primarily focus on traffic filtering with customizable rules.

  3. EC2 Instance Launch Steps

    When launching a new EC2 instance, which of the following must you select to define the type of underlying hardware?

    1. IAM Role
    2. Placement Group
    3. Instance Type
    4. Availability Zone

    Explanation: Choosing an instance type specifies the hardware configuration, such as CPU, memory, and storage capacity, used by your EC2 instance. An IAM Role is for permissions, not hardware. Availability Zone defines the physical location, not the instance's characteristics. Placement Groups influence networking, not the primary hardware configuration.

  4. Basics of Subnets

    Which statement best describes a subnet in a virtual private cloud?

    1. It is a global network resource
    2. It provides DNS services
    3. It manages firewall rules
    4. It is a range of IP addresses within a VPC

    Explanation: A subnet represents a segment of IP addresses within the boundaries of a virtual network, allowing resources to be organized and managed. It is not a global network resource, as it exists inside a specific VPC. While firewall rules are managed by security groups and network ACLs, a subnet itself does not provide DNS services directly.

  5. Elastic IP Address Usage

    Why would you associate an Elastic IP address with an EC2 instance in a VPC?

    1. To automatically encrypt network traffic
    2. To provide a static, public IPv4 address
    3. To create an additional subnet
    4. To improve instance storage speed

    Explanation: Elastic IPs offer persistent public IPv4 addresses, ensuring consistent access even if the underlying resource changes. Creating additional subnets is unrelated to Elastic IPs. Storage performance and network encryption are separate concerns handled by different services and configurations. The primary use is maintaining a stable external IP address.

  6. Default VPC Components

    Which component is automatically created when a default VPC is set up in a new region?

    1. Multiple VPN connections
    2. A public subnet
    3. A custom NACL
    4. A network load balancer

    Explanation: A public subnet is automatically set up within each default virtual network, allowing resources to access the internet. Custom network access control lists (NACLs) are not default; the default NACL is created automatically. Multiple VPN connections and network load balancers are not created by default with new VPCs.

  7. VPC Peering Fundamentals

    What is a primary purpose of establishing a VPC peering connection?

    1. Automatically scaling compute resources
    2. Enabling shared use of security groups across regions
    3. Assigning Elastic IP addresses to resources
    4. Connecting two virtual networks to route traffic between them

    Explanation: VPC peering enables resources in different virtual networks to communicate using private addresses, facilitating secure inter-network traffic. Sharing security groups across regions is not done via VPC peering. Elastic IP assignments and automatic resource scaling are unrelated to VPC peering functionality.

  8. EBS Volume Attachment

    In a typical setup, what can an EBS volume be attached to?

    1. A security group
    2. A single running EC2 instance at a time
    3. Multiple EC2 instances in different availability zones
    4. A network interface

    Explanation: An EBS volume can be attached to only one running EC2 instance at a time within the same zone, allowing persistent block-level storage. Attaching to multiple EC2 instances across different zones is not supported. Security groups and network interfaces are not attachable resources for storage volumes.

  9. Public vs. Private Subnet

    How can you ensure that an EC2 instance in a subnet does not have direct internet access?

    1. Attach an Elastic IP to the instance
    2. Assign a public IP to the instance
    3. Place the instance in a private subnet without a route to an internet gateway
    4. Add the instance to a placement group

    Explanation: A private subnet without a route to an internet gateway prevents instances from communicating directly with the public internet. Assigning a public IP or Elastic IP makes those instances reachable from the public internet. Placement groups are used for networking within the cloud, not for controlling internet access.

  10. Stopping vs Terminating EC2 Instances

    What happens to the root storage volume when you stop an EC2 instance, rather than terminate it?

    1. The instance can't be started again
    2. The root volume is deleted
    3. All attached volumes are encrypted
    4. The root volume remains and persists data

    Explanation: When an instance is stopped, the root volume is not deleted and retains stored data, allowing the instance to be restarted. Root volume deletion typically happens only upon termination, depending on configuration. Instances can be started after stopping, and encryption is a separate configuration not triggered by stopping.