How do I save my Jibri Recordings to AWS S3 bucket?

I need help saving my jibri recordings to AWS S3 bucket. I have configured my finalize.sh script as below, but it’s not working. Getting aws: command not found in the logs

#!/bin/bash

AWS credentials

AWS_ACCESS_KEY=xxxx
AWS_SECRET_KEY=xxxx
AWS_DEFAULT_REGION=xxxx
S3_BUCKET_NAME=xxxx

RECORDINGS_DIR=$1

echo “Uploading the recording to S3”

Get the folder name

RECORDINGS=ls $RECORDINGS_DIR/*.mp4
RECORDINGS=basename $RECORDINGS
FOLDER_NAME=$(echo $RECORDINGS | tr “_” “\n”)

for name in $FOLDER_NAME
do
FOLDER_NAME=$name
break
done

upload(){

echo “Uploading…”

Set credentials for aws cli

aws configure set aws_access_key_id $AWS_ACCESS_KEY
aws configure set aws_secret_access_key $AWS_SECRET_KEY
aws configure set default.region $AWS_DEFAULT_REGION

Upload to S3

aws s3 sync $RECORDINGS_DIR s3://$S3_BUCKET_NAME/recordings/$FOLDER_NAME/

Get the instance ID and terminate the EC2 instance

die() { status=$1; shift; echo “FATAL: $*”; exit $status; }
INSTANCE_ID="wget -q -O - http://169.254.169.254/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\""

aws ec2 terminate-instances --instance-ids $INSTANCE_ID

}

upload

How is it not working? What kind of errors are you seeing?

aws: command not found

You need to install the aws cli package.

I have installed aws cli package on the server using sudo apt-get install awscli but the error still persists.

Do I need to add the installation command in finalize.sh?

The script may not have the aws command in its path.

Find out where the aws command is by running which aws, then in your script use the full path.

which aws yields /usr/bin/aws

Adding that path to the script gives me /usr/bin/aws: No such file or directory

what is the output for

dpkg -l jibri awscli

dpkg-query: no packages found matching jibri
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
++±==============-========================-============-==========================================
ii awscli 1.18.69-1ubuntu0.20.04.1 all Universal Command Line Environment for AWS

awscli and jibri are not on the same machine

Jibri is actually installed as a docker image. My setup is shown in the screenshot attached. Wondering why jibri is not being detected. I’m I missing something?

If Jibri runs in a container then you need to install the aws cli inside the container.

Thanks. Now I’m getting Could not connect to the endpoint URL. I have the correct endpoint but how do I set it in finalize.sh?

Got it working with --endpoint-url my-endpoint

Thank you so much!

Glad you got it working!

1 Like