Automating EMR Serverless with Amazon EventBridge - Amazon EMR
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Automating EMR Serverless with Amazon EventBridge

You can use Amazon EventBridge to automate your Amazon Web Services and respond automatically to system events, such as application availability issues or resource changes. EventBridge delivers a near real-time stream of system events that describe changes in your Amazon resources. You can write simple rules to indicate which events are of interest to you, and what automated actions to take when an event matches a rule. With EventBridge, you can automatically:

  • Invoke an Amazon Lambda function

  • Relay an event to Amazon Kinesis Data Streams

  • Activate an Amazon Step Functions state machine

  • Notify an Amazon SNS topic or an Amazon SQS queue

For example, when you use EventBridge with EMR Serverless, you can activate an Amazon Lambda function when an ETL job succeed or notify an Amazon SNS topic when an ETL job fails.

EMR Serverless emits two kinds of events:

  • Application state change events – Events that emit every state change of an application. For more information about application states, see Application states.

  • Job run state change events – Events that emit every state change of a job run. For more information about, see Job run states.

Sample EMR Serverless EventBridge events

Events reported by EMR Serverless have a value of aws.emr-serverless assigned to source, as in the following examples.

Application state change event

The following example event shows an application in the CREATING state.

{ "version": "0", "id": "9fd3cf79-1ff1-b633-4dd9-34508dc1e660", "detail-type": "EMR Serverless Application State Change", "source": "aws.emr-serverless", "account": "123456789012", "time": "2022-05-31T21:16:31Z", "region": "us-east-1", "resources": [], "detail": { "applicationId": "00f1cbsc6anuij25", "applicationName": "3965ad00-8fba-4932-a6c8-ded32786fd42", "arn": "arn:aws:emr-serverless:us-east-1:123456789012:/applications/00f1cbsc6anuij25", "releaseLabel": "emr-6.6.0", "state": "CREATING", "type": "HIVE", "createdAt": "2022-05-31T21:16:31.547953Z", "updatedAt": "2022-05-31T21:16:31.547970Z", "autoStopConfig": { "enabled": true, "idleTimeout": 15 }, "autoStartConfig": { "enabled": true } } }

Job run state change event

The following example event shows a job run that moves from the SCHEDULED state to the RUNNING state.

{ "version": "0", "id": "00df3ec6-5da1-36e6-ab71-20f0de68f8a0", "detail-type": "EMR Serverless Job Run State Change", "source": "aws.emr-serverless", "account": "123456789012", "time": "2022-05-31T21:07:42Z", "region": "us-east-1", "resources": [], "detail": { "jobRunId": "00f1cbn5g4bb0c01", "applicationId": "00f1982r1uukb925", "arn": "arn:aws:emr-serverless:us-east-1:123456789012:/applications/00f1982r1uukb925/jobruns/00f1cbn5g4bb0c01", "releaseLabel": "emr-6.6.0", "state": "RUNNING", "previousState": "SCHEDULED", "createdBy": "arn:aws:sts::123456789012:assumed-role/TestRole-402dcef3ad14993c15d28263f64381e4cda34775/6622b6233b6d42f59c25dd2637346242", "updatedAt": "2022-05-31T21:07:42.299487Z", "createdAt": "2022-05-31T21:07:25.325900Z" } }