Video backup to Amazon S3
At api.video we understand that sometimes, you want to make sure that your videos are safe and secure. Although api.video has a backup and disaster recovery plan, it’s up to you to decide if you want an extra backup resource or if you would like to use api.video just to transcode your videos but eventually store them on a different resource.
That’s why, we’ve created this guide so you can store the videos you’ve already transcoded with api.video on a file storage resource.
How it’s done?
This guide will explain how you can store your transcoded videos on Amazon S3 Account. In short, all you need to do is run a small script that will copy the videos from api.video to Amazon S3. The videos will be kept on api.video as well, however, if you wish to delete them you can do so by leveraging the
DELETE /videos endpoint, more information can be found here.
What we will need to run the script?
- api.video API key, you can find the information on how to retrieve the API key in the Retrieve your api.video API key guide
- Amazon S3 credentials
- Copy the Amazon S3 region from the console
- api.video Cold Storage script,
- Node.js and npm, you can find the installation instructions here
- Typescript, you can find the installation instructions here
Getting the Amazon S3 credentials
You can find the guide of getting the Amazon S3 Access Key id and Secret Key here
After you’ve got all the keys and installed node.js, npm and typescript, you can proceed with cloning the script from GitHub.
Cloning the Cold Storage script
- In the command line enter the following
- Once the script is cloned, you can navigate the script directory
Setting up the script
Once you are in the script directory, install the dependencies
After the dependencies are installed, we will need to enter the credentials we have copied in the preparation phase.
.env file and replace the following with the keys you've received from AWS and api.video.
# possible providers: google, aws, azure # api.video API key # the name of the bucket on Google Amazon S3 or the container on Azure Storage # Amazon S3 credentials
Don’t forget to save the file.
Running the backup
Once you've got all the keys in place in the
.env file, it's time to run the script. As we are running the script on TypeScript, we will need to build it first, hence, the first command you need to run in the script folder is:
After the script was built, it’s time to run it:
Was this page helpful?