Site icon Dipin Krishna

How To Mount an AWS S3 bucket on an Ubuntu Server

Ubuntu

To mount an AWS S3 bucket on Ubuntu, you can use a tool called “s3fs.” S3fs allows you to access your AWS S3 bucket as if it were a local directory on your Ubuntu machine. Here’s a step-by-step guide to help you with the process:

1. Install dependencies:
First, ensure you have the necessary packages installed on your Ubuntu system. Open a terminal and run the following commands:

sudo apt update
sudo apt install build-essential libfuse-dev fuse-utils libcurl4-openssl-dev libxml2-dev pkg-config automake

2. Install s3fs:
Now, you can proceed with the installation of s3fs. You can either compile it from source or install it using package managers like apt or snap. Here, we’ll use the apt package manager:

sudo apt install s3fs

3. Configure AWS credentials:
Next, you need to provide your AWS credentials to s3fs, so it can authenticate with AWS. You can do this by editing the `~/.passwd-s3fs` file:

echo "ACCESS_KEY_ID:SECRET_ACCESS_KEY" > ~/.passwd-s3fs
chmod 600 ~/.passwd-s3fs

Replace `ACCESS_KEY_ID` and `SECRET_ACCESS_KEY` with your actual AWS IAM user’s credentials that have appropriate access to the S3 bucket.

4. Create a directory for mounting:
Choose a directory on your Ubuntu machine where you want to mount the S3 bucket. For example, create a directory named “s3_mount”:

mkdir ~/s3_mount

5. Mount the S3 bucket:
Finally, you can use s3fs to mount the S3 bucket onto the directory you created:

s3fs bucket-name ~/s3_mount

Replace “bucket-name” with the name of your AWS S3 bucket.

That’s it! The S3 bucket should now be mounted on your Ubuntu machine, and you can access its contents as if they were part of your local file system under the “s3_mount” directory. Remember that s3fs provides a simple way to access and use S3 buckets, but it may not perform as fast as a dedicated storage solution, especially for large amounts of data or high I/O operations.

Exit mobile version