Posts

Showing posts with the label AWS S3

Mount AWS S3 Bucket on AWS EC2 [ AWS IAM Role based Authentication]

Mounting an S3 Bucket to Linux: A Step-by-Step Guide Mounting an S3 Bucket to Linux: A Step-by-Step Guide Mounting an S3 bucket to a Linux instance allows you to utilize scalable object storage for large files directly within your file system. This guide will walk you through the process, from installing necessary packages to creating and verifying the mount. Step 1: Install FUSE Packages First, you need to install the required FUSE packages. Open your terminal and execute the following command: yum -y install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel Step 2: Clone the S3FS-FUSE Repository Next, clone the S3FS-FUSE application from GitHub: git clone https://github.com/s3fs-fuse/s3fs-fuse Step 3: Change Directory to the Cloned Repository Navigate to the cloned directory: cd s3fs-fuse Step 4: Build and Install S3FS-FUSE Run the following comman...

AWS S3 Bucket Sizer || Bash Script

  #! /bin/sh set -e # Script finds all buckets within the specified account and outputs the total size together with the number of files contained in the bucket. usage () { echo " Usage: $0 <aws config profile> " echo " e.g.: $0 aws_production " echo " Make sure your AWS CLI is configured " echo " " exit 1 } if [ -z " $1 " ] ; then usage fi AWS_PROFILE= $1 # find all buckets in the account. S3_BUCKET_IDS= $( aws s3api list-buckets --profile $AWS_PROFILE --query ' Buckets[*].Name ' --output text ) for i in ${S3_BUCKET_IDS[@]} do echo " calculating size of bucket: " $i aws s3api --profile $AWS_PROFILE list-objects --bucket $i --output json --query " [sum(Contents[].Size), length(Contents[])] " | awk ' NR!=2 {print $0;next} NR==2 {print $0/1024/1024/1024" GB"} ' done