Modify Elastic Block Storage (EBS) Volumes for Bitnami Applications on AWS
Introduction
If your Bitnami application running on Amazon Web Services (AWS) is running out of storage space, you can increase available storage by creating a new Amazon Elastic Block Store (EBS) volume and transferring your application to it, or by expanding the existing EBS volume. EBS volumes are persistent block storage volumes that are available in either SSD or HDD format and come with a 99.99% availability guarantee for maximum data security and reliability.
This guide walks you through both options.
Assumptions and prerequisites
This guide assumes that you have a Bitnami application running on AWS, deployed using the AWS Marketplace, the AWS Console or Amazon Lightsail.
The procedure to increase the disk space available to your Bitnami application host will differ depending on whether your Bitnami application was deployed through Amazon Lightsail or not. Refer to the appropriate section below.
Bitnami applications deployed through Amazon Lightsail
Step 1: Identify your Bitnami application instance in the Amazon Lightsail dashboard
The first step is to identify your Bitnami application instance and note down its name and availability zone. To do this:
-
Log in to the Amazon Lightsail dashboard.
-
Select the “Instances” tab.
-
Note the instance name and availability zone. You will need these details in subsequent steps.
Step 2: Create and attach a storage volume
The next step is to create a new storage volume and attach it to the Bitnami application instance. Here’s how:
-
Log in to the Amazon Lightsail dashboard (if you’re not already logged in).
-
Select the “Storage” tab.
-
Click the “Create disk” button.
-
On the “Create an additional storage disk” page, select the region and size for the new disk and give it a unique name. It is important to select the same region as your instance identified in Step 1. Click the “Create disk” button to proceed.
-
On the “Attach to an instance” page, select your Bitnami application instance from the list of available instances.
-
Click the “Attach” button to attach the new storage volume to the instance. Note the disk path displayed at the end of the process.
Step 3: Format and mount the storage volume
The next step is to let the Bitnami application instance know about the new volume. This involves formatting the instance with a file system and mounting it so that it can be used. Perform the following steps:
-
At the console, run the lsblk command and confirm that the storage volume has been mapped by checking the device name from Step 2 against the command output.
$ sudo lsblk
-
Format the new device with mkfs, remembering to use the device name from Step 2:
$ sudo mkfs.ext4 /dev/xvdX
-
Create a directory and mount the volume with mount. As before, use the correct device name from Step 2 in the commands below.
$ sudo mkdir /data $ sudo mount -t ext4 /dev/xvdX /data
Once mounted, check that the storage volume is available with df.
-
Edit the /etc/fstab file and add an entry to it for the new volume, as shown below. Modify the device name to reflect the device name from Step 2.
/dev/xvdX /data ext4 defaults,nofail
This ensures that the volume will be automatically remounted if you reboot the instance.
Your new storage volume is now mounted and available for use. To add more volumes, repeat Steps 2 and 3.
Step 4: Move the Bitnami application to the new storage volume
Execute the commands below to move the Bitnami application to the new volume:
$ sudo /opt/bitnami/ctlscript.sh stop
$ sudo mv /opt/bitnami /data/bitnami
$ sudo ln -sf /data/bitnami /opt/bitnami
$ sudo /opt/bitnami/ctlscript.sh start
Bitnami applications deployed through the AWS Marketplace or the AWS Console
Step 1: Identify the volume in the AWS EC2 Console
The first step is to identify your Bitnami application instance. To do this:
-
Log in to the AWS EC2 console.
-
From the “Services” menu, select the “EC2” service.
-
From the EC2 Dashboard, select the “Instances -> Instances” menu item.
-
Search for and select your Bitnami application instance from the list of available instances.
-
From the instance details pane, note the EBS identifier of the root device.
-
Stop the instance using the “Actions -> Instance State -> Stop” menu item
Step 2: Modify the volume
The next step is to modify the volume size. Here’s how:
-
Log in to the AWS EC2 console (if you’re not already logged in).
-
From the “Services” menu, select the “EC2” service.
-
From the EC2 Dashboard, select the “Elastic Block Store -> Volumes” menu item.
-
Search for and select the volume attached to your instance using the EBS identifier for the previous step.
-
Select the “Actions -> Modify Volume” menu item.
-
In the “Modify Volume” dialog, modify the size of the volume as required. Click “Modify” to save the changes.
-
Once the modification has been registered, return to the list of instances in the EC2 dashboard.
-
Search for and select your Bitnami application instance from the list of available instances.
-
Restart the instance using the “Actions -> Instance State -> Start” menu item
The Bitnami initialization script will automatically resize the partition to use the new volume size when the instance restarts.
Useful links
To learn more about the topics discussed in this guide, consider visiting the following links: