– Amazon Simple Storage Service ( Amazon S3 ) provides secure and highly scalable storage and it is easy to upload, download or delete files/folders from or into the bucket. This post shows how to create an S3 bucket and steps to mount the created bucket into a Linux OS.
Steps to create S3:
1) Login to the AWS and choose S3 from the Dashboard. This will open a window where you configure S3 as shown below.
2) It also shows the list of available buckets if you have created any buckets previously. To create a new bucket choose Create Bucket option.
3) Enter the bucket name and select a region and click on Create button which will create a bucket with the name that you have entered and it lies in the region that has chosen
4) To view the buckets, select S3 from services which shows the list of available buckets. A similar screenshot is shown above.
5) Double click on that bucket to upload/download or delete files or folders and the interface will be simple and easy to understand.
Mounting S3 to Linux OS:
– The storage that we have created in Amazon can be mounted to any OS. Here follow the below steps to mount the storage into Linux OS.
1) Install fuse and s3fs packages:
– First check for any previous installation of these packages in the OS and if there is any remove the packages as we have to install the latest one. There are dependencies RPM’s that is used to compile the latest version of package. So it is safe to install the latest version of packages. Run the following commands
– rpm -qa | grep fuse s3fs –> This command will search for any previous installation of these packages and will display the packages with version if there is any.
– If there are any packages that are installed previously we have to remove those packages by running following command.
yum remove fuse s3fs
– Once the older version packages are removed install the new version by downloading it and compile the source code with in it. Download the latest version from the below link. Download the latest one from the site. The below one is just an example.
– Choose the latest version and download it using ‘wget’ command. The usage of the command is shown below.
wget http://downloads.sourceforge.net/project/fuse/fuse2.X/2.9.3/fuse-2.9.3.tar.gz –> This will download the file and store it in the present path.
– Later extract the file and compile the source code and run the following commands.
tar -xvzf fuse-2.9.3.tar.gz
make && make install
– Commands explanation in order. First extract the file, change the directory, compile the configuration file ( at this step if there are any dependencies missing you will get errors and from that errors find the missing dependency packages and install those ), install the package after compilation, configure dynamic linking runtime bindings and add fuse module to the runlevel directory.
– Similarly download s3fs file from the below link and perform the same operations that we did for installing fuse package except last two steps. Download the latest one from the site. The below one is just an example.
2) Setting up access keys:
– Under root home directory create a new file named ‘.passwd-s3fs‘ and we have to put the access keys into the file in the order shown below.
– Save and exit the file and later change the permission to the file for 640.
3) Mounting S3 bucket:
– Run the following command to mount S3 bucket to the Linux machine. Before that make sure you create a directory locally to mount the bucket.
s3fs bucketname /path/to.local/directory.
Ex: The command s3fs sample12345 /opt/s3 will mount the bucket locally under /opt/s3 directory.
– To make the file system available permanently edit fsatab and save & exit the changes.
With this, creating and mounting S3 bucket has covered.