Menu

Vercel Sandbox now supports FUSE-based filesystems - Vercel
📰

Vercel Sandbox now supports FUSE-based filesystems - Vercel

Vercel News·Brandon Tuttle·5 days ago
#wQokpXAa
#vercel#sandbox#process#await#runcommand
Reading 0:00
15s threshold

import { Sandbox } from '@vercel/sandbox' ;

const sandbox = await Sandbox . create ( ) ;

// Install Mountpoint for Amazon S3 (official release) and its FUSE dependency.

await sandbox . runCommand ( {

sudo : true ,

cmd : 'dnf' ,

args : [

'install' ,

'-y' ,

'fuse' ,

'https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.rpm' ,

] ,

} ) ;

const MOUNT_DIR = '/mnt/s3'

await sandbox . runCommand ( {

sudo : true , cmd : 'mkdir' , args : [ '-p' , MOUNT_DIR ]

} ) ;

// Pass aws credentials only to the mount-s3 command.

// Note: this does expose the credentials permanently in the sandbox!

// Use a restricted role only

await sandbox . runCommand ( {

sudo : true ,

cmd : 'mount-s3' ,

args : [

process . env . S3_BUCKET_NAME ,

MOUNT_DIR ,

'--allow-other' ,

] ,

env : {

AWS_ACCESS_KEY_ID : process . env . AWS_ACCESS_KEY_ID ,

AWS_SECRET_ACCESS_KEY : process . env . AWS_SECRET_ACCESS_KEY ,

AWS_SESSION_TOKEN : process . env . AWS_SESSION_TOKEN ,

AWS_REGION : process . env .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.