I tried saving Twilio Programmable Video recordings in S3

Twilio is a cloud communications platform that allows software developers to programmatically make and receive phone calls, send and receive text messages, and perform other communication functions using its Application Programming Interfaces (APIs).


1. Twilio Account

2. Twilio Programmable Video setup

3. AWS account

Let's start-

To save the recordings to an external S3 bucket, we have to enable few settings.

Let's make a S3 bucket with required permissions. The S3 bucket in which we have to store the recordings should only have 'PutObject' permission. For that we have to make a new IAM user with S3PutObjectPolicy.

Make a new IAM user by clicking on the Users tab.

Add user name and all the other necessary details, then select 'next' button.

Here comes the main part. We have to give ONLY 's3PutObjectPolicy' policy. Twilio will generate error if we'll provide any other permission or attach any other policy other than this.

After this, we just have to review and Create User. Don't forget to store the username and password and also download the .csv file for future.

Let's go to S3 now.

Create a new bucket and give your desired bucket name. Make sure to uncheck 'Block all public access' checkbox to make the bucket public. Keep all the other settings as default.

After creating the bucket, click on the 'Properties' tab and scroll to the end. Click on edit Static website hosting tab. Enable it and type 'index.html' under Index document.

Under 'Permissions' tab, edit the bucket policy and type the given bucket policy only for 'PutObject' permission.

    "Version": "2012-10-17",
    "Id": "Policy1676355339093",
    "Statement": [
            "Sid": "Stmt1676355329791",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn"
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::bucket-name/*"

In the above policy, under Principal, type the ARN of your IAM user which we created few minutes before. And under Resource, type the bucket ARN.

Save everything we did until now.

Let's go to Twilio and go to 'Programmable Video' option. Under Video, let's go to 'Manage'>'Recording Settings'. Click on 'Add new credential' tab and enter an appropriate friendly name, AWS Access Key Id and AWS Access Secret Key.

Next, let's add the endpoint URL of the S3 bucket we created earlier.

Then click on 'Save' button. Now, whenever you will run your Twilio Video and record the video, your recordings will be saved in your S3 bucket.

I hope this article will help you understand Twilio better. In case of any question, please drop a comment below. Thank you for your time.

Happy Learning!