

# Monitoring Amazon Translate events with Amazon EventBridge
<a name="monitoring-with-eventbridge"></a>

Amazon Translate integrates with Amazon EventBridge to notify you about changes that affect your translation jobs and parallel data resources. Events from AWS services are delivered to EventBridge in near real time. 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. For example, actions that can be automatically started include:
+ Invoking an AWS Lambda function
+ Invoking AWS Systems Manager Run Command
+ Relaying the event to Amazon Kinesis Data Streams
+ Activating an AWS Step Functions state machine
+ Notifying an Amazon SNS topic or an Amazon SQS queue

For more information, see [Creating Amazon EventBridge rules that react to events](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule.html) in the *Amazon EventBridge User Guide*.

## Amazon Translate events
<a name="monitoring-with-eventbridge-events"></a>

The following are example events from Amazon Translate.

### Events for batch translation jobs
<a name="monitoring-with-eventbridge-events"></a>

You run batch translation jobs by using the Amazon Translate console or the [StartTextTranslationJob](https://docs.aws.amazon.com/translate/latest/APIReference/API_StartTextTranslationJob.html) operation. Amazon Translate sends events when these jobs are complete, either successfully or unsuccessfully. These events resemble the following example.

```
{
 "version": "0", 
 "id": "CWE-event-id", 
 "detail-type": "Translate TextTranslationJob State Change", 
 "source": "aws.translate", 
 "account": "111122223333", 
 "time": "2017-04-22T03:31:47Z", 
 "region": "us-east-1", 
 "resources": [], 
 "detail": {
    "jobId": "01234567-0123-0123-0123-012345678901", 
    "jobStatus": "STATUS" 
 } 
}
```

The value for the `jobStatus` attribute depends on the job state that Amazon Translate sent the event for. The `jobStatus` values are:
+ `COMPLETED` – The job has successfully completed and the output is available.
+ `COMPLETED_WITH_ERROR` – The job has completed with errors. The errors can be analyzed in the job's output.
+ `STOPPED` – The job has been stopped.
+ `FAILED` – The job did not complete. To get details, use the [DescribeTextTranslationJob](https://docs.aws.amazon.com/translate/latest/APIReference/API_DescribeTextTranslationJob.html) operation.

### Events for parallel data resources
<a name="monitoring-with-eventbridge-events"></a>

When you use Amazon Translate to create or update a parallel data resource, it sends an event to indicate whether the operation succeeded or failed.

You create parallel data resources by using the Amazon Translate console or the [CreateParallelData](https://docs.aws.amazon.com/translate/latest/APIReference/API_CreateParallelData.html) operation. When you do this, Amazon Translate sends an event like the following.

```
{
 "version": "0", 
 "id": "CWE-event-id", 
 "detail-type": "Translate Parallel Data State Change", 
 "source": "aws.translate", 
 "account": "111122223333", 
 "time": "2017-04-22T03:31:47Z", 
 "region": "us-east-1", 
 "resources": [arn:aws:translate:us-east-1:111122223333:parallel-data/ExampleParallelData], 
 "detail": {
    "operation": "CreateParallelData",
    "name": "ExampleParallelData", 
    "status": "STATUS"
 } 
}
```

Values for the `status` attribute are:
+ `ACTIVE` – The `CreateParallelData `operation succeeded, and the resource is ready for you to use.
+ `FAILED` – The `CreateParallelData` operation failed.

You update parallel data resources by using the Amazon Translate console or the [UpdateParallelData](https://docs.aws.amazon.com/translate/latest/APIReference/API_UpdateParallelData.html) operation. When you do this, Amazon Translate sends an event like the following.

```
{
 "version": "0", 
 "id": "CWE-event-id", 
 "detail-type": "Translate Parallel Data State Change", 
 "source": "aws.translate", 
 "account": "111122223333", 
 "time": "2017-04-22T03:31:47Z", 
 "region": "us-east-1", 
 "resources": [arn:aws:translate:us-east-1:111122223333:parallel-data/ExampleParallelData], 
 "detail": {
    "operation": "UpdateParallelData",
    "name": "ExampleParallelData", 
    "status": "STATUS",
    "latestUpdateAttemptStatus": "STATUS",
    "latestUpdateAttemptAt": "2017-04-22T03:31:47Z"
 } 
}
```

The `status` attribute provides the status of the prior version of the parallel data resource, which is being replaced by the update. Values are:
+ `ACTIVE` – The prior version was created or updated successfully.
+ `FAILED` – The prior version failed to be created or updated.

The `latestUpdateAttemptStatus` attribute provides the status of the new version of the parallel data resource, which is being created by the update. Values are:
+ `ACTIVE` – The `UpdateParallelData` operation succeeded, and the updated resource is ready for you to use.
+ `FAILED` – The `UpdateParallelData` operation failed.