I have bucket named test bucket and I need to mount this bucket under /var/www/html/upload. the bucket is having 33 GB data. I am using below command to mount
/usr/bin/s3fs -o allow_other test var/www/html/upload
[buck name] [mount point ]
it mounted but when I try to list the files it throws error like as given below
df: ‘/var/www/html/upload: Transport endpoint is not connected
Also is there any way to change the ownership of the directory in which I have mounted S3 bucket. when I try to do that I getting below error
cp: preserving permissions for ‘/upload/pp-11415-AfQqcI3t_o.jpg’: Operation not supported
It would be great if someone help on this. Thanks in Advance.
Here are my steps:
Lauch Amazon Linux AMI : amzn-ami-hvm-2018.03.0.20200602.1-x86_64-gp2 (ami-05ca073a83ad2f28c)
Install S3FS from https://github.com/s3fs-fuse/s3fs-fuse/wiki/Installation-Notes
Install aws cli : https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html
Create test bucket : test-bucket
Create IAM role with below policy
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":[
"s3:ListAllMyBuckets"
],
"Resource":"arn:aws:s3:::*"
},
{
"Effect":"Allow",
"Action":[
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource":"arn:aws:s3:::test-bucket"
},
{
"Effect":"Allow",
"Action":[
"s3:PutObject",
"s3:PutObjectAcl",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:DeleteObject"
],
"Resource":"arn:aws:s3:::test-bucket/*"
}
]
}
Attach Role to instance. Role is test-role
created /upload directory
finally use below command to mount s3 bucket.
sudo s3fs -o iam_role="test-role " -o url="https://s3-eu-central-1.amazonaws.com" -o endpoint=eu-cal-1 -o dbglevel=info -o curldbg -o allow_other -o use_cache=/tmp test-bucket /upload
verify mount folder
df -h
change ownership
sudo chown -R ec2-user:ec2-user /upload
Able to create test file in /upload with some content and also can see same file in S3 console.
Hope it will help you.