Setup Online Meeting Recording With AWS Chime SDK

Afrimadoni Dinata
5 min readMay 12, 2020

--

AWS Chime is video call platform which allow developer to build their own solution on top of Chime SDK, in this tutorial I’ll show you step-by-step on how to setup recording application for video conference and save the output media into S3 bucket.

disclaimer: I’m using demo applications from AWS it self, the reason why I’m writing this because I have to make little changes to the code to make it work. My computer environment are MacOS Sierra, nodejs v12.7.0 and NPM 6.14.4

Deploy Serverless Meeting Demo

First you need to clone/download demo application from here, make sure you already have AWS CLI and AWS SAM CLI installed in your system. You’ll also need following permissions granted to your user: IAMFullAccess, AmazonChimeFullAccess, AmazonAPIGatewayAdministrator, AmazonECS_FullAccess, AmazonSSMFullAccess, AmazonVPCFullAccess, AWSCloudFormationFullAccess, AmazonEC2FullAccess, AmazonSQSFullAccess, AWSLambdaFullAccess, AmazonS3FullAccess (I’m using full access since it’s just a demo, for real case you should assign required permissions only)

git clone https://github.com/aws/amazon-chime-sdk-js.git .
cd amazon-chime-sdk-js/demos/serverless

Install dependecies then deploy, in my scenario I’ll deploy it in region ap-southeast-1 with bucket name mychime-artefact (you may need to enable transfer acceleration). This demo uses CloudFormation so I’ve to pass parameter stack name.

npm install
npm run deploy -- -r ap-southeast-1 -b mychime-artefact -s chime-meeting -a meeting

Once deployment succeed you can see in terminal a URL that can be opened in a browser. Go to that url and start a meeting, the url might look like this: https://xxx.execute-api.ap-southeast-1.amazonaws.com/Prod/

join screen

To simulate a meeting you can open it in multiple browser, please remember to use the same Meeting ID.

meeting dashboard

at this step you will have these resources created: CloudFormation stack, S3 bucket, Lambda and API Gateway.

Deploy Recording Demo Application

For recording purpose we need to deploy another application, this because Chime doesn’t have recording API (at the time I’m writing this). The second application will record everything on screen including video and audio then save it into S3 bucket. The original architecture and steps can be found here, but instead of Cloud9 I’ll deploy it from local AWS CLI.

Error in Cloud9 console

Create Amazon ECR repository from CLI:

aws ecr create-repository --repository-name <repository-name>

Clone the github repository then build and push docker image to your repository:

git clone https://github.com/aws-samples/amazon-chime-sdk-recording-demo.git
cd amazon-chime-sdk-recording-demo
make ECR_REPO_URI=<repositoryUri>

Repository URL can be found in Amazon ECR dashboard

ECR dashboard

When I run deployment command with default CloudFormation template it’s always return error so I have to do little modification to file RecordingDemoCloudformationTemplate.yaml, change value of BucketName to a unique name (recording media will be saved into this bucket) and change InstanceType to t2.2xlarge (somehow t3.xlarge always crash and return CPU error every time start recording endpoint being called).

change bucket name
change instance type

Run deployment script and change required parameter to respective values:

node ./deploy.js -b <my-bucket> -s <my-stack> -i <docker-image-uri> -r <region>

the second bucket name is to put deployment artefacts, you can use the same bucket which be used to store output media. Docker image uri can be found inside ECR, just click on repository name.

Docker image URI

After deployment success you’ll see Amazon API Gateway invoke URL in the output.

deployment success

Now let’s see how it works completely, start a meeting and invite multiple attendees to join. Start recording by invoking recording URL from postman or any other tool, remember to select select “AWS Signature” and add your AccessKey, SecretKey &AWS Region in the Authorization tab.

hint: if you don’t remember AccessKey or SecretKey, you can find them in file ~/.aws/credentials

AWS credentials file

Send HTTP POST request and passed the recordingAction as "start" and a url encoded meetingURL query parameters to API Gateway. Add “v2” to meeting url, for example if your meeting url is https://xxx.execute-api.ap-southeast-1.amazonaws.com/Prod/?m=MyMeeting then use the v2 url: https://xxx.execute-api.ap-southeast-1.amazonaws.com/Prod/v2/?m=MyMeeting

meeting url
request and response in Postman

At this point the entire web page is captured by FFmpeg at 1280 X 720 fidelity and automatically transcoded and uploaded to Amazon S3. The file created in Amazon S3 will remain hidden until the capture is complete. Our demo application has been modified to suppress prompts for input device permissions and display customized UI for the recording bot.

To stop recording, pass the task ARN as taskId that was received in the API response to start the recording in addition to the recordingAction denoting "stop".

stop recording endpoint

All done! recording media can be found in S3 bucket.

--

--