How to create and get a channel in Amazon IVS with AWS SDK for Javascript?

Viewed 332

I'm a beginner at AWS, and what I'm trying to create is a live stream program using Amazon IVS. To do that I need to create and get a channel by using SDK for javascript. I'm also using AWS SAM with NodeJs, Lambda, and API. app.js

var AWS = require('aws-sdk');

var s3 = new AWS.S3({apiVersion: '2006-03-01'});
var ivs = new AWS.IVS({apiVersion: '2020-07-14'});


exports.lambdaHandler = async (event, context) => {

ivs.batchGetChannel(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});
    
ivs.createChannel(params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
});

Im also following the documentation for it which is: https://docs.aws.amazon.com/ivs/latest/APIReference/IVS%20API.pdf#API_CreateChannel and https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/IVS.html#createChannel-property

The unknown part is the flow of the work about this, wanted to ask if I'm doing right, and if not, would appriciate any suggestion or demo to follow it. Thank you!

0 Answers
Related