Menu
AWS Elemental MediaConvert
User Guide

Tutorial: Setting Up Email Notifications for Failed Jobs

In this tutorial, you configure a CloudWatch Events event rule that captures events when a job status changes to ERROR and then notifies you about the event. To do this, you first create a topic in Amazon SNS that will send you an email notification about the failed job. Next, you create a rule in CloudWatch Events by defining an event source and referencing the Amazon SNS topic (the "target"), as shown in the following illustration.


                This CloudWatch Events rule brings together a job event that has an error and an Amazon SNS
                    topic.

Prerequisites

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

Step 1: Create a Topic in Amazon SNS

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. In the navigation pane, choose Topics, and then choose Create new topic.

  3. For Topic name, type MediaConvertJobErrorAlert, and then choose Create topic.

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

  5. On the Topic details: MediaConvertJobErrorAlert page, in the Subscriptions section, choose Create subscription.

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

  7. Choose Create subscription.

  8. You will receive an email from AWS Notifications. When you receive it, choose the Confirm subscription link in the email.

Step 2: Specify an Event Source in a CloudWatch Events Rule

Next, specify your event source in a CloudWatch Events rule to capture only events that are generated by a job status that changes to ERROR.

To set up an event source in a CloudWatch Events rule

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

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

  3. In the Event Source section, choose Event Pattern, and then choose the element labeled Build event pattern to match events by service. From the resulting dropdown list, choose Custom event pattern.

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

    { "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 the Amazon SNS Topic and Finish Your Rule

Next, add the target (the Amazon SNS topic) that you created in Step 1 to the CloudWatch Events rule that you started in Step 2.

To add the SNS topic and finish the CloudWatch Events rule

  1. In the Targets section, choose Add targets, and then change the default Lambda function to SNS topic.

  2. For Topic*, choose MediaConvertJobErrorAlert.

  3. Choose the Configure details button.

  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 cause an error. For example, specify an input location that does not exist. If you configured your event rule correctly, you should receive an email with the event text message in a few minutes.

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 that you specified when you set up your Amazon SNS topic. Confirm that you received an email notification for the job error.