I need a solution to store CCTV events somewhere in the cloud (preferably Amazon S3
), to be able to download them later. All of the EZViz cameras has its own cloud service, but it is not suitable for me for some reasons:
- I have to pay for that
- The payment amount depends on the duration of the archived records
- There is no subscription plan to store records older than 30-day
- The subsription plan for maximum storage duration (30-day) has a crazy price of ~$100 per year
- There is a server that stores the RTSP stream (
recorder
app). The server has a backend application (processor
) with REST API endpoint to return the event file by its timestamp. - I configured the EZViz application to send notification emails to the email address of my own domain name.
- The notification email is processed with Amazon Simple Email Service:
- Saves raw message to Amazon S3 bucket
- Triggers Amazon Lambda function (
mailhandler
)
- The
mailhandler
processes email:- Extract timestamp from the email body
- Creates a Amazon DynamoDB record that contains email ID, event timestamp and processing flag (is false)
- There is another Amazon Lambda function (
eventprocessor
) that is triggered by Amazon EventBridge every minute:- Get unprocessed events from the DynamoDB table with timestamp less than 2 minutes ago:
- Fetch event video file from the backend server
- Store it in the S3 bucket
- Update
processed
flag, setfile
path in the DynamoDB record
- Get unprocessed events from the DynamoDB table with timestamp less than 2 minutes ago:
- I built a simple dashboard application to view all videos for a specific date
Camera backend (recorder
, processor
):
- Go
- ffmpeg
- gorilla/mux
Amazon Lambda functions:
- Go
Dashboard application:
- NextJS
- React
- Typescript
- Tailwind CSS
- Deployed on the Netlify
- Domain name ownership with DNS hosting feature
Amazon Web Services
account- A Linux server to process RTSP stream and upload event videos to the cloud. I use Raspberry Pi 3B+ for this purpose.
- Docker installation
- Nginx
- Enable email notifications
- Setup
Amazon Route 53
- Setup
Amazon Simple Email Service
- Setup
Amazon S3
- Setup
Amazon Lambda
- Setup
Amazon DynamoDB
- Setup processor server
- Deploy camera dashboard
Configure camera settings in the EZViz application to send motion event notifications via E-Mail. Motion event messages will start arriving in the inbox.
Add appropriate MX
records to the domain name.
Configure Amazon Simple Email Service
to receive incoming emails to your domain name and store raw messages into the Amazon S3
bucket.
Configure email address in the EZViz application to send emails to your domain address.