Yet another developer blog

TIL how to mount S3 bucket on Windows


Édité: 2025-06-11 12:21

Setting up everything

Install rclone and winfsp using Chocolatey:

1choco install winfsp
2choco install rclone

Create a policy to access your S3 bucket my-bucket:

 1{
 2  "Version": "2012-10-17",
 3  "Statement": [
 4    {
 5      "Sid": "VisualEditor0",
 6      "Effect": "Allow",
 7      "Action": ["s3:ListBucket", "s3:GetBucketLocation"],
 8      "Resource": "arn:aws:s3:::my-bucket"
 9    },
10    {
11      "Sid": "VisualEditor1",
12      "Effect": "Allow",
13      "Action": ["s3:PutObject", "s3:GetObject", "s3:DeleteObject"],
14      "Resource": "arn:aws:s3:::my-bucket/my-folder/*"
15    }
16  ]
17}

Create a user IAM and attach the policy.

Generate a key pair.

To setup the key in environment variables you can use the following Powershell:

1$Env:AWS_ACCESS_KEY_ID = "your_access_key_id"
2$Env:AWS_SECRET_ACCESS_KEY = "your_secret_access_key"

In order to list all environment variable:

1Get-ChildItem Env:

Mounting the S3 bucket

We need to update the rclone configuration file at C:\Users\Administrator\AppData\Roaming\rclone\rclone.conf:

[aws_s3]
type = s3
provider = AWS
env_auth = false
region = eu-west-3
access_key_id = your_access_key_id
secret_access_key = your_secret_access_key

To get content: Get-Content C:\Users\Administrator\AppData\Roaming\rclone\rclone.conf

In order to mount the S3 bucket:

1rclone mount aws_s3:my-bucket/my-folder S: --vfs-cache-mode full

rclone can not be run in background according to the documentation:

On Windows you can run mount in foreground only, the flag is ignored.

To bypass this we can run and hide the Powershell window:

Start-Process powershell.exe -ArgumentList '-Command "rclone mount aws_s3:my-bucket/my-folder S: --vfs-cache-mode full > nul"' -WindowStyle Hidden

You are done!

Ressources

Édité: 2025-06-11 12:21
cleanup: remove welcome section from homepage and adjust tags in blog posts

#TIL