-
Notifications
You must be signed in to change notification settings - Fork 8
Expand storage to AWS S3
If you are using a Raspberry Pi camera (onboard/USB/etc.) to monitor when the alarm is triggered, it is a good idea to backup the photos and videos in cloud - in the case the thief steals you RPi.
The following guide shows how to mount a AWS S3 to the Raspberry Pi.
- AWS account
- AWS key and secret
Create bucket: nimha
Create folder: media (this will be nimha/media)
sudo apt install s3fs
[2019 March] Current s3fs
version available on Raspbian Stretch is v1.81
. Installing with apt install
can cause problems with the connection due to gnucrypt
. This should be fixed in v1.85
. It is therefore advised to compile s3fs
from source.
sudo apt-get install build-essential git libfuse-dev libcurl4-openssl-dev libxml2-dev mime-support automake libtool
sudo apt-get install pkg-config libssl-dev
git clone https://github.com/s3fs-fuse/s3fs-fuse
cd s3fs-fuse/
./autogen.sh
./configure --prefix=/usr --with-openssl
make
sudo make install
nano /home/pi/nimha/.passwd-s3fs
Insert:
key:secret
Set permission:
chmod 600 /home/pi/nimha/.passwd-s3fs
sudo mkdir /mnt/nimha
chown pi:pi /mnt/nimha
nano /etc/fuse.conf
- uncomment:
user_allow_other
id
Find your user and group id - could be 1000 for both. They are needed in the umask detail.
s3fs nimha /mnt/nimha -o umask=1000 -o passwd_file=/home/pi/nimha/.passwd-s3fs -o endpoint=eu-west-1 -o allow_other
fusermount /mnt/nimha
sudo nano /lib/systemd/system/nimhas3.service
[Unit]
Description=nimhas3
After=network-online.target
[Service]
User=pi
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/s3fs nimha /mnt/nimha -o umask=1000 -o passwd_file=/home/pi/nimha/.passwd-s3fs -o endpoint=eu-west-1 -o allow_other
ExecStop=/bin/fusermount -u /mnt/nimha
[Install]
WantedBy=multi-user.target
systemctl enable nimhas3
systemctl start nimhas3
If you are running NimHA through systemctl, it is important, that the S3 mounting is happening first. You need to add the S3 mount as prerequisite.
Open:
sudo nano /lib/systemd/system/nimha.service
And change the "After" line to:
After=network-online.target nimhas3.service
- Home
- Requirements
- Install NimHA
- Optional
- Modules
- Tutorials (helpers, etc.)
- Development