The CloudFormation template install will default to standard magnetic EBS volume type. Magnetic does not support resizing, so you'll have to create a snapshot, create a new volume, and then then remount it.
(1) Stop your EC2 instance
Go to EC2 and select your instance
Go to Actions > Instance State > Stop
In the EC2 instance details, make a note of the Availability zone (you'll need this later)
Also note the Root device mount path. For example, this might be
/dev/xvda (you'll need this later too)
(2) Find your instance's EBS volume
A shortcut I like to use is to click on the Root device
/dev/xvda link in the EC2 instance details. In the pop-up, click on the link next to EBS ID.
(3) Go to Actions > Create Snapshot. This creates a backup.
For the snapshot description, type in
SFTP Gateway snapshot
Add a tag.
SFTP Gateway snapshot
Click Create Snapshot
Click the link provided to navigate to your snapshot.
Wait a few moments for the snapshot to create. Use the refresh button near the top right of the screen.
(4) Create a volume from the snapshot
Go to Actions > Create Volume
General Purpose SSD (GP2) as the Volume Type
Change the volume size
Change the Availability Zone to match your EC2 instance's AZ
Add a Tag so you can easily identify the volume later
Click Create Volume
Click the link to navigate to your Volume Id.
(5) Unmount the magnetic volume
Find the original magnetic EBS volume. You can go back to your EC2 instance, and click on
Go to Actions > Detach Volume
(6) Mount the resized GP2 volume
Find the resized GP2 EBS volume
Go to Actions > Attach volume
Select the SFTP Gateway instance from the drop down menu
For Device, enter the root device path (i.e.
/dev/xvda, or whatever you noted earlier)
(7) Start the EC2 instance
Run the following command to make sure you're utilizing the new volume size
(Note: most CloudFormation template installations default to standard magnetic EBS volume type. Please refer to the section above for resizing instructions)
The best approach would be to resize the EC2 instance volume. AWS provides instructions on how to do so here:
This document can be pretty intimidating. But here's a condensed version:
Run the following (note the space between xvda and 1):
sudo growpart /dev/xvda 1
Run the following:
sudo resize2fs /dev/xvda1
Here's what's going on. Increasing the EC2 volume is a 3-step process. Imagine you're inflating 3 balloons nested inside each other. But you have to inflate the outer one first to make room for the inner ones.
growpart. You can use
lsblkto verify that you're using the full 64 GB volume.
resize2fs. You use
df -hto verify that you're using the full partition.
The documentation has a lot of explanation and tangents for edge cases that you can refer to. But the actual process is just Modify Volume in the AWS console, and two commands: