Ends in
00
days
00
hrs
00
mins
00
secs
SHOP NOW

🚀 25% OFF All Practice Exams, Video Courses, & eBooks – Cyber Sale Extension!

Guided Lab: Managing Network Interfaces in Amazon EC2

Description

A Network Interface in Amazon EC2 represents a virtual network card. Each network interface can include attributes such as a primary private IPv4 address, one or more secondary private IPv4 addresses, an IPv6 address, an Elastic IP address (if applicable), a MAC address, and one or more security groups. Network interfaces play a crucial role in networking and can be attached or detached from instances, offering flexibility in network configuration.

Every EC2 instance has a primary network interface attached by default when launched. However, you can create and manage additional network interfaces to customize the networking setup of your instances, allowing you to handle various networking needs like traffic segmentation, high availability, and more.

This lab will walk you through creating a secondary network interface and attaching or detaching it from an EC2 instance.

Prerequisites

This lab assumes you have the following:

  • Basic knowledge and understanding of Amazon EC2

If you find any gaps in your knowledge, consider taking the following lab:

Objectives

By the end of this lab, you will:

  • Understand how to create and manage additional network interfaces in EC2.
  • Learn how to attach and detach a secondary network interface from an EC2 instance.

Lab Steps

Create a Network Interface

1. Navigate to the EC2 Dashboard.

How to launch an Amazon EC2 Linux instance

2. In the EC2 left sidebar, scroll down to the Network & Security section in the left sidebar and select Network Interfaces.

3. Click on Create network interface.

4. Configure the following settings:

    • Description: Add a description to describe your Network interface ( example: “My network interface”)
    • Subnet: Choose a subnet from the dropdown list. Make sure the subnet is in the same VPC as the instance you plan to attach this network interface to. (For example: us-east-1a)
    • Private IPv4 address: Leave it in Auto-assign.
    • Security Groups: Select an existing security group or create a new one. 

  • Click Create network interface.

5. Note down the Network Interface ID for reference.

Launch an EC2 Intance

1. Launch an EC2 Instance with the following configuration:

  • Name: myWebServer
  • AMI: Amazon Linux
  • Instance type: t2.micro
  • Key pair: (You can either create a new one or Proceed without a key pair in this lab.)
    If you choose to create a new one follow the following:
    • Key pair name:myKeyPair
    • KeyPairKey pair type: RSA
    • Private key file format: .pem
  • Network settings: (Click “ Edit”)
    • Subnet: Ensure you choose the SAME Subnet as subnet of your Network interface created earlier

  • Leave the rest as default. Click Launch Instance.
Attach the Secondary Network Interface to an EC2 Instance

1. Select the instance created earlier.

3. Click on Actions > Networking > Attach network interface.

4. Select the network interface you created from the dropdown list and click Attach.

5. Verify that the secondary network interface is now listed in the Network Interfaces section of the instance details.

Detach the Secondary Network Interface

1. Go back to the Network Interfaces section in the EC2 dashboard.

2. Select the secondary network interface you created.

3. Click Actions > Detach

    • If a pop-up appears, Click Detach.

4. Confirm the detachment and verify that the network interface is no longer attached to the instance.

Congratulations! You have successfully created, attached, and detached a secondary network interface in Amazon EC2. This process is crucial for scenarios where you need additional flexibility in managing traffic or multiple IP addresses, for instance.

Key Takeaways:

  • Every EC2 instance has a primary network interface by default, which cannot be detached.
  • Additional network interfaces can be attached to or detached from instances to meet networking requirements.
  • Properly managing network interfaces is essential for configuring security and handling traffic flows.

As a best practice, remember to delete any resources no longer in use to maintain a clutter-free AWS environment.

Thank you for joining this lab, and happy learning!

Skip to content