Question:
I would like to add an option for users to upload videos to a website. I am wondering about AWS Elemental MediaConvert for handling the necessary transcoding.
Using the aws sdk, I can submit a job to aws Elemental MediaConvert for transcoding like so…
1 2 |
const result = await new AWS.MediaConvert({apiVersion: '2017-08-29'}).createJob(params).promise() |
…However this just returns the newly created job. I cannot seem to see anywhere how to actually know when the job completes. I am wondering: Is there a simple way to know when the job actually completes (or fails) so that I can send a response back to the client?
Answer:
One way to do this is by using CloudWatch Events and Simple Notification Service (SNS).
You’d have to:
- Set up an HTTP endpoint on your web server to handle incoming notifications.
- Create an SNS topic and subscribe your HTTP endpoint to the topic.
- Set up the CloudWatch Event Rule just as zolaemil described and set the target of the event to the SNS topic.
When your MediaConvert job completes, it will trigger the CloudWatch Event and will send the job result to SNS, which will then forward it to your web server. So you’re effectively pushing from MediaConvert to your web server instead of polling.