Skip to content

Instantly share code, notes, and snippets.

@mattzuba
Created November 24, 2014 16:23
Show Gist options
  • Save mattzuba/ad42f2680c4c30feb5bb to your computer and use it in GitHub Desktop.
Save mattzuba/ad42f2680c4c30feb5bb to your computer and use it in GitHub Desktop.
s3fs-fuse on AWS Elastic Beanstalk
packages:
yum:
gcc: []
libstdc++-devel: []
gcc-c++: []
fuse: []
fuse-devel: []
libcurl-devel: []
libxml2-devel: []
openssl-devel: []
mailcap: []
automake: []
sources:
/tmp: https://github.com/s3fs-fuse/s3fs-fuse/archive/v1.78.zip
files:
"/etc/fuse.conf" :
mode: "000644"
owner: root
group: root
content: |
# mount_max = 1000
user_allow_other
"/opt/elasticbeanstalk/hooks/appdeploy/pre/11_unmount_s3fs.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
if mountpoint -q [/path/on/filesystem]; then
fusermount -u [/path/on/filesystem]
fi
"/opt/elasticbeanstalk/hooks/appdeploy/enact/02_mount_s3fs.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
. /opt/elasticbeanstalk/support/envvars
# Make sure it's mounted as the webapp user
id=`id -u webapp`
s3fs [your-bucket]:[/optional/path/in/bucket] [/path/on/filesystem] -o nonempty -o uid=$id -o gid=$id -o use_cache=/tmp -o allow_other
commands:
01_patch_s3fs:
cwd: /tmp/s3fs-fuse-1.78/src
command: "sed -i 's/AWSACCESSKEYID/AWS_ACCESS_KEY_ID/g;s/AWSSECRETACCESSKEY/AWS_SECRET_KEY/g' s3fs.cpp"
02_install_s3fs:
cwd: /tmp/s3fs-fuse-1.78
test: "[ ! -x /usr/bin/s3fs ]"
command: "autoreconf --install && export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && ./configure --prefix=/usr && make && make install"
@willwade
Copy link

NB: If you want a NodeJS container Ive forked this here: https://gist.github.com/willwade/ad351d680428d4a3f090 - note the big thing is that ". /opt/elasticbeanstalk/support/envvars" doesn't exist on a nodejs container. Technically the official guide says you don't have access to env vars unless you put your commands in container_commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment