DEV Community

Cover image for Managing Elastic IPs and Elastic Block Storage (EBS) in AWS - Week Eleven
Shubham Murti
Shubham Murti

Posted on • Updated on

Managing Elastic IPs and Elastic Block Storage (EBS) in AWS - Week Eleven

Hello Community! 🌟

This week, I delved into the intricacies of Elastic IPs and Elastic Block Storage (EBS) in AWS. Below, I provide a detailed summary of what I learned and accomplished, focusing on understanding their functionalities, managing them effectively, and practical applications.

Elastic/Static IPs

Understanding Elastic IP

Elastic IP addresses are static IPv4 addresses designed for dynamic cloud computing. Unlike traditional static IPs, Elastic IPs can be associated and disassociated with different instances as needed. This flexibility makes them ideal for scenarios requiring consistent public IP addresses.

Attaching an Elastic/Static IP to an EC2 Instance

To associate an Elastic IP with an EC2 instance:

Allocate an Elastic IP:

  1. Open the AWS Management Console and navigate to the EC2 Dashboard.
  2. Select "Elastic IPs" from the left-hand menu and click "Allocate Elastic IP address."
  3. Click "Allocate" to get a new Elastic IP address.

Associate the Elastic IP:

  1. Select the Elastic IP address, click "Actions," and choose "Associate Elastic IP address."
  2. Select the instance or network interface to associate with the Elastic IP and click "Associate."

How to Give a Static IP to Your Instance

By associating an Elastic IP with an instance, you ensure that the instance has a consistent public IP address that won't change even if the instance is stopped or restarted. This is crucial for applications needing a stable endpoint, such as web servers.

Real-Life Usage

Elastic IPs are commonly used for hosting websites and applications where a consistent IP address is necessary. For instance, when running a web server that needs to be accessed using a domain name, the DNS records can point to the Elastic IP.

Detaching Elastic/Static IP

To disassociate an Elastic IP from an instance:

  1. Navigate to the "Elastic IPs" section in the EC2 Dashboard.
  2. Select the Elastic IP address to detach, click "Actions," and choose "Disassociate Elastic IP address."
  3. Confirm the disassociation to release the IP from the instance.

Elastic Block Storage (EBS)

Overview

EBS provides persistent block storage for EC2 instances, allowing for data storage that persists independently of the instance's lifecycle. This makes EBS ideal for applications requiring reliable and scalable storage solutions.

Creating Your First EBS Volume

To create an EBS volume:

  1. Open the AWS Management Console and navigate to the EC2 Dashboard.
  2. Select "Volumes" from the left-hand menu and click "Create Volume."
  3. Choose the volume type (e.g., General Purpose SSD), size, and availability zone.
  4. Click "Create Volume."

Attaching an EBS Volume to an EC2 Instance

To attach an EBS volume:

  1. Select the EBS volume you created.
  2. Click "Actions" and choose "Attach Volume."
  3. Select the instance to attach the volume to and specify the device name (e.g., /dev/sdf).
  4. Click "Attach."

Detaching an EBS Volume from One EC2 Instance and Attaching It to Another

To detach and reattach an EBS volume:

  1. Select the volume, click "Actions," and choose "Detach Volume."
  2. Confirm the detachment.
  3. Follow the steps above to attach the volume to a different instance.

Resizing an EBS Volume and the File System

To resize an EBS volume:

  1. Select the volume to resize, click "Actions," and choose "Modify Volume."
  2. Specify the new size and click "Modify."
  3. Connect to the instance and resize the file system. For Linux, you can use the resize2fs command (e.g., sudo resize2fs /dev/xvdf).

How to Resize the Root EBS Volume

To resize the root volume:

  1. Select the root volume (usually /dev/xvda), click "Actions," and choose "Modify Volume."
  2. Specify the new size and click "Modify."
  3. Restart the instance.
  4. Resize the file system using the appropriate command for the OS.

Attaching One EBS Volume to Multiple Instances

EBS volumes can be attached to multiple instances only if they are in read-only mode, primarily used for scenarios like shared storage for multiple instances.

  1. Create an EBS volume and attach it to the primary instance.
  2. Configure the volume to be shared in read-only mode.
  3. Attach the volume to other instances in read-only mode.

Closure

Understanding and effectively managing Elastic IPs and EBS in AWS is crucial for ensuring the availability, scalability, and reliability of your applications. Elastic IPs provide consistent IP addresses for dynamic cloud resources, while EBS offers persistent storage solutions that adapt to your evolving needs. By mastering these AWS components, you can enhance your cloud infrastructure and optimize resource management.

Stay tuned for more updates next week!

Shubham Murti — Aspiring Cloud Security Engineer | Weekly Cloud Learning !!

Let’s connect: Linkdin, Twitter, Github

Top comments (0)