Software on an additional volume in an EC2 instance

2 min readJun 19, 2023
  1. Launch an EC2 instance: Start by launching a new EC2 instance or use an existing one.

2. Attach an additional volume: In the EC2 console, navigate to the “Volumes” section and create a new Amazon EBS volume. Choose the desired size, availability zone, and other configurations. Once the volume is created, select it and click on “Actions” > “Attach Volume.” Choose the EC2 instance you want to attach the volume to and specify the device name (e.g., /dev/xvdf).

3. Connect to the EC2 instance: Connect to your EC2 instance using SSH or any other remote access method.

4. Check available volumes: Run the command `lsblk` to list the available block devices and verify that the additional volume (/dev/xvdf or the device name you specified) is present.

5. Format the volume: If the additional volume is new, you need to format it with a file system before you can use it. For example, to format it with the ext4 file system, run the command `sudo mkfs -t ext4 /dev/xvdf`.

6. Create a mount point: Choose a directory where you want to mount the additional volume. For example, you can create a new directory with `sudo mkdir /mnt/myvolume`.

7. Mount the volume: Use the `mount` command to mount the volume to the chosen directory. Run the command `sudo mount /dev/xvdf /mnt/myvolume` to mount the volume to the directory you created.

8. Verify the mount: Run `df -h` to display the mounted file systems and confirm that the additional volume is correctly mounted.

9. Install Python: Now that the volume is mounted, you can proceed to install Python. Here are the steps to install Python using the source code:

. a. Download the Python source code: Go to the Python downloads page ( and find the version you want to install. Download the source code tarball (e.g., Python 3.9.6) using `wget` or any other tool. For example: `wget`.

. b. Extract the source code: Use the `tar` command to extract the source code from the downloaded tarball. For example: `tar -xzf Python-3.9.6.tgz`.

. c. Configure the installation: Change into the extracted directory (`cd Python-3.9.6`) and run the configure command to prepare the installation. For example: `./configure – prefix=/mnt/myvolume/python`.

. d. Build and install Python: Run `make` to build the Python binaries and then run `sudo make install` to install Python on the additional volume.

10. Verify the installation: Run `/mnt/myvolume/python/bin/python3 – version` to verify that Python is installed correctly. You should see the Python version printed.

By following these steps, you can install Python on an additional volume in an EC2 instance. Adjust the commands and paths as per your specific configuration and the Python version you want to install.


aws ec2 attach-volume --volume-id <volume-id> --instance-id <instance-id> --device /dev/xvdf

Format the volume (assuming ext4 file system):

sudo mkfs -t ext4 /dev/xvdf

Mount point

sudo mkdir /mnt/myvolume

Mount the volume

sudo mount /dev/xvdf /mnt/myvolume

Install Python from source:

tar -xzf Python-3.9.6.tgz
cd Python-3.9.6
./configure --prefix=/mnt/myvolume/python
sudo make install

/mnt/myvolume/python/bin/python3 – version




I am a OpenSource Enthusiast|Python Lover who attempts to find simple explanations for questions and share them with others