Select Page

Purpose

This article gives the steps to mount an Amazon Web Service Simple Storage Service on CentOS or RHEL 6 over a VPC Endpoint.

Create IAM User

Create an IAM user that will be used to access S3 from your EC2 instances.

  1. Login to AWS web console
  2. Open IAM | Users
  3. Select Create New User
  4. Enter a user name
    1. i.e. s3user
  5. Copy generated access keys
  6. Set a complicated/long password for the user

OR You can use an IAM Role then include the role in the s3fs mount command

iam_role (default is no role)

Create S3 Bucket

  1. Login to AWS web console
  2. Select Services | S3
  3. Create a S3 bucket
    1. mywebapp-uploads
  4. Add bucket policy to allow IAM User and VPC Endpoint access to all files inside the bucket.

Install Dependencies

CentOS/RHEL/Amazon

Ubuntu

Install Latest Fuse

s3fs requires fuse >= 2.8.4. Default yum repo on CentOS 6 at the time of writing this pulls down fuse-2.8.3-4. So you’ll want to uninstall the repo fuse version and install the latest fuse from source. Amazon Linux default is high enough version

  1. Uninstall fuse
  2. Download latest version
    1. http://sourceforge.net/projects/fuse/files/fuse-2.X/
  3. Extract tar
  4. Change to the extracted directory
  5. Configure package
  6. Compile and Install package
  7. Symlink fusermount to /usr/bin (Optional)

Install s3fs (Github)

  1. Download s3fs
    1. git clone https://github.com/s3fs-fuse/s3fs-fuse.git
  2. Change to the extracted directory
  3. Run Auto Generate Shell Script
  4. Configure package
  5. Compile and Install package
  6. Symlink s3fs to /usr/bin (Optional)

Install s3fs (Older Method)

  1. Download s3fs
    1. http://tecadmin.net/mount-s3-bucket-centosrhel-ubuntu-using-s3fs/#
  2. Extract tar
  3. Change to the extracted directory
  4. Configure package
  5. Compile and Install package
  6. Symlink s3fs to /usr/bin (Optional)

Install s3fs Libraries

  1. Edit /etc/ld.so.conf
  2. Add this line to the top:
  3. Rerun ldconfig

Create Access Key File

Create a text file with the access keys.

Setup Auto Mount (fstab)

  1. Edit /etc/fstab
  2. Add the following
  3. Remount all in fstab

Sources