AWS SDK for JavaScript
Developer Guide for SDK v2

Getting Your Account-Specific Endpoint for MediaConvert

JavaScript code example that applies to Node.js execution

This Node.js code example shows:

  • How to retrieve your account-specific endpoint from MediaConvert.

The Scenario

In this example, you use a Node.js module to call MediaConvert and retrieve your account-specific endpoint. You can retrieve your endpoint URL from the service default endpoint and so do not yet need your acccount-specific endpoint. The code uses the SDK for JavaScript to retrieve this endpoint by using this method of the MediaConvert client class:

Prerequisite Tasks

To set up and run this example, first complete these tasks:

Configuring the SDK

Configure the SDK for JavaScript by creating a global configuration object, and then setting the region for your code. In this example, the region is set to us-west-2.

// Load the SDK for JavaScript var AWS = require('aws-sdk'); // Set the region AWS.config.update({region: 'us-west-2'});

Getting Your Endpoint URL

Create a Node.js module with the file name emc_getendpoint.js. Be sure to configure the SDK as previously shown.

Create an object to pass the empty request parameters for the describeEndpoints method of the AWS.MediaConvert client class. To call the describeEndpoints method, create a promise for invoking an MediaConvert service object, passing the parameters. Handle the response in the promise callback.

// Load the AWS SDK for Node.js var AWS = require('aws-sdk'); // Set the region AWS.config.update({region: 'us-west-2'}); // Create empty request parameters var params = { MaxResults: 0, }; // Create a promise on a MediaConvert object var endpointPromise = new AWS.MediaConvert({apiVersion: '2017-08-29'}).describeEndpoints(params).promise(); endpointPromise.then( function(data) { console.log("Your MediaConvert endpoint is ", data.Endpoints); }, function(err) { console.log("Error", err); } );

To run the example, type the following at the command line.

node emc_getendpoint.js

This sample code can be found here on GitHub.