Menu
AWS Elemental MediaConvert
User Guide

Tutorial: Sending Amazon Simple Notification Service Alerts for Failed Jobs

In this tutorial, you configure a CloudWatch Events event rule that only captures events where the job status has moved to ERROR. To do this, you will first set up a target in Amazon SNS, then create a rule in CloudWatch Events by defining event source and referencing the Amazon SNS target, as illustrated in this diagram.


                This CloudWatch Events rule brings together an the errored job event and an Amazon SNS
                    topic.

Prerequisites

This tutorial assumes that you already know how to create AWS Elemental MediaConvert transcoding jobs. For information on creating jobs, see Setting Up a Job in AWS Elemental MediaConvert. At the end of this tutorial, you can submit a job that you have designed to fail, to test that you have configured your Amazon SNS alerts correctly.

Step 1: Set Up a Target Amazon SNS Topic

The first part of setting up a CloudWatch Events rule is preparing the rule target. In this case, that means creating and subscribing to an Amazon SNS topic.

To create an Amazon SNS topic

  1. Open the Amazon SNS console at https://console.aws.amazon.com/sns/v2/home.

  2. Choose Topics, Create new topic.

  3. For Topic name, enter MediaConvertJobErrorAlert and choose Create topic.

  4. Choose the topic ARN link for the topic that you just created. It will look something like this arn:aws:sns:region:123456789012:MediaConvertJobErrorAlert.

  5. On the Topic details: MediaConvertJobErrorAlert screen, choose Create subscription.

  6. For Protocol, choose Email. For Endpoint, enter the email address you Amazon SNS to send the alert to.

  7. Choose Create subscription.

  8. Check the email account, and wait to receive a subscription confirmation email message. When you receive it, choose Confirm subscription.

Step 2: Begin Creating a CloudWatch Events Rule by Specifying the Event Source

Next, set up your event source in a CloudWatch Events rule to capture only events generated by a job status changing to ERROR.

To set up a CloudWatch Events rule event source

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, choose Events, Create rule.

  3. Under Build event pattern to match events by service, choose Custom event pattern.

  4. For Build custom event pattern, replace the existing text with the following text:

    Copy
    { "source": [ "aws.mediaconvert" ], "detail": { "status": [ "ERROR" ] } }

    This code defines a CloudWatch Events event rule that matches any event where the job status changes to ERROR. For more information about event patterns, see Events and Event Patterns in the Amazon CloudWatch User Guide.

Step 3: Add Amazon SNS Target and Finish Rule

Next, add the target you created in Step 1 to the CloudWatch Events rule you started in Step 2.

To finish the CloudWatch Events rule

  1. For Targets, change the default Lambda function to SNS topic.

  2. For Topic*, choose MediaConvertJobErrorAlert.

  3. Choose Configure details.

  4. For Rule definition, type a name and description for your rule and then choose Create rule.

Step 4: Test Your Rule

To test your rule, submit a job that you know will error. For example, specify an input location that does not exist. If your event rule is configured correctly, you receive an email message within a few minutes with the event text.

To test the rule

  1. Open the AWS Elemental MediaConvert console at https://console.aws.amazon.com/mediaconvert.

  2. Submit a new AWS Elemental MediaConvert job. For more information, see Setting Up a Job in AWS Elemental MediaConvert.

  3. Check the email account you specified when you set up your Amazon SNS topic to confirm that you have received an email notification for the job error.