DEV Community

Latchu@DevOps
Latchu@DevOps

Posted on

πŸš€ Automatically Mount S3 Buckets at Boot with Mountpoint for Amazon S3 + fstab

πŸ”§ AWS just made it easier to auto-mount S3 buckets on EC2 instances using fstab and Mountpoint for Amazon S3!

Amazon recently announced that Mountpoint for Amazon S3 now supports automatic mounting via the Linux fstab file. This is a game-changer if you're tired of manually remounting S3 buckets every time your EC2 instance reboots.

πŸ” What’s New?

Previously, using Mountpoint for S3 meant:

  • Running mount-s3 manually after every reboot
  • Reconfiguring mount options every time
  • Risk of misconfiguration

Now, with the fstab integration, your instance can automatically mount S3 buckets on startupβ€”just like an EBS volume or NFS share. πŸŽ‰

πŸ§ͺ Step-by-Step Example

Let’s walk through a simple example to see how this works.

πŸ› οΈ Prerequisites

  • Mountpoint for Amazon S3 is installed
  • Your instance IAM role has S3 access
  • You have an S3 bucket, e.g., my-s3-bucket

βœ… 1. Create the Mount Directory

sudo mkdir -p /mnt/my-bucket
Enter fullscreen mode Exit fullscreen mode

βœ… 2. (Optional) Test Manual Mount

Try mounting it manually first to verify access:

sudo mount-s3 my-s3-bucket /mnt/my-bucket
Enter fullscreen mode Exit fullscreen mode

If you can list files inside /mnt/my-bucket, you’re good!

βœ… 3. Add Entry to /etc/fstab

Open the file:

sudo nano /etc/fstab
Enter fullscreen mode Exit fullscreen mode

Add the following line:

my-s3-bucket /mnt/my-bucket s3 _netdev,allow_other 0 0
Enter fullscreen mode Exit fullscreen mode

⚠️ Make sure to replace s3 with the actual filesystem type used by Mountpoint (typically just s3).

βœ… 4. Test It!

Run:

sudo mount -a
Enter fullscreen mode Exit fullscreen mode

No errors? Then it's working! πŸŽ‰ Your S3 bucket will now auto-mount on every reboot.

🧠 Why It Matters

This small addition simplifies infrastructure management:

πŸ’Ύ Persistent S3 access

βš™οΈ Better for automation and scripting

πŸ” Useful for containers, EC2 fleets, and bootstrapping

Have you tried it yet? Let me know how you’re using Mountpoint in your workflow! πŸš€πŸ‘‡

Top comments (0)