AWS Machine Learning Blog

Getting a batch job completion message from HAQM Translate

May 2025: This post was reviewed and updated for accuracy.

HAQM Translate is a neural machine translation service that delivers fast, high-quality, and affordable language translation. Neural machine translation is a form of language translation automation that uses deep learning models to deliver more accurate and natural-sounding translation than traditional statistical and rule-based translation algorithms. The translation service is trained on a wide variety of content across different use cases and domains to perform well on many kinds of content.

The HAQM Translate asynchronous batch processing capability enables organizations to translate a large collection of text, HTML documents and other supported file formats. They can translate the collection of documents from one language to another with just a single API call. The ability to process data at scale is becoming important to organizations across all industries. In this blog post, we are going to demonstrate how you can build a notification mechanism to message you when a batch translation job is complete. This can enable end-end automation by triggering other Lambda functions or integrate with SQS for any post processing steps.

Solution overview

The following diagram illustrates the high-level architecture of the solution.

The solution contains the following steps:

  1. A user starts a batch translation job.
  2. An HAQM EventBridgerule picks up the event and sends an notification to HAQM SNS. You can also configure other AWS services as targets in HAQM EventBridge.
  3. When the HAQM Translate batch job is complete, an email notification is sent via an HAQM Simple Notification Service(HAQM SNS) topic.

To implement this solution, you must create the following:

  1. An SNS topic
  2. An AWS Identity and Access Management (IAM) role
  3. An HAQM EventBridge rule

Creating an SNS topic

To create an SNS topic, complete the following steps:

  1. On the HAQM SNS console, choose Topics in the navigation pane.
  2. Choose Create topic.
  3. Choose Type as Standard.
  4. For Topic name, enter a name (for example, TranslateJobNotificationTopic).
  5. Choose Create topic.

You can now see the TranslateJobNotificationTopic page. The Details section displays the topic’s name, ARN, display name (optional), and the AWS account ID of the Topic owner.

  1. 6. In the Details section, copy the topic ARN to the clipboard (arn:aws:sns:us-east-1:123456789012:TranslateJobNotificationTopic).
  2. On the left navigation pane, choose Subscriptions.
  3. Choose Create subscription.
  4. On the Create subscription page, enter the topic ARN of the topic you created earlier (arn:aws:sns:us-east-1:123456789012:TranslateJobNotificationTopic).
  5. For Protocol, select Email.
  6. For Endpoint, enter an email address that can receive notifications.
  7. Choose Create subscription.

For email subscriptions, you have to first confirm the subscription by choosing the confirm subscription link in the email you received.

Creating an HAQM EventBridge rule

To create a HAQM EventBridge rule, complete the following steps. This rule catches when a user performs a StartTextTranslationJob API event and triggers the step function (set as a target).

  1. On the HAQM EventBridge console, choose Rules.
  2. Choose Create rule.
  3. On the Step 1: Define rule detail page, enter a name for the rule.
  4. Under Rule type, select Rule with an event pattern.
  5. Choose Next.
  6. On the Step 2: Build event pattern page, under Event source choose AWS events or EventBridge partner events.
  7. Under Event pattern, Choose custom pattern.
  8. Enter the following code into the preview pane:
    {
      "source": ["aws.translate"],
      "detail-type": ["Translate TextTranslationJob State Change"],
      "detail": {
        "jobStatus": ["COMPLETED", "FAILED"]
      }
    }
  9. Choose Next.
  10. For Targets, select AWS service and select SNS topic.
  11. Select the SNS topic you created earlier.
  12. For permission to send events to Step Functions, select Create a new role for this specific resource.
  13. Choose Next.
  14. Add appropriate tags (Optional) and choose Next.
  15. Review details and Choose Create rule.

Validating the solution

To test this solution, I first create an HAQM Translate batch job and provide the input text HAQM Simple Storage Service (HAQM S3) location, output HAQM S3 location, target language, and the data access service role ARN. For instructions on creating a batch translate job, see Asynchronous Batch Processing or Translating documents with HAQM Translate, AWS Lambda, and the new Batch Translate API.

The following screenshot shows my batch job on the Translation jobs page.

HAQM translate job start screenshot of Translate console

The HAQM EventBridge rule picks up the job completion event and sends an event to the configured target. When the job is complete, I get an email notification via HAQM SNS.

Conclusion

In this post, we demonstrated how you can use HAQM EventBridge events for an HAQM Translate batch job. For this use case, we configured an email notification to send when a job is complete; however, you can use this framework to trigger other AWS Services which are supported as targets in HAQM EventBridge like Lambda functions or integrate with HAQM Simple Queue Service (HAQM SQS) for any postprocessing automated steps, enabling you to build an end-to-end automated workflow. For further reading, see the following:


About the Authors

Sudhanshu Malhotra is a Boston-based Enterprise Solutions Architect for AWS. He is a technology enthusiast who enjoys helping customers find innovative solutions to complex business challenges. His core areas of focus are DevOps, Machine Learning, and Security. When he’s not working with customers on their journey to the cloud, he enjoys reading, hiking, and exploring new cuisines.

Siva Rajamani is a Boston-based Enterprise Solutions Architect for AWS. He enjoys working closely with customers, supporting their digital transformation and AWS adoption journey. His core areas of focus are Serverless, Application Integration, and Security. Outside of work, he enjoys outdoor activities and watching documentaries.

Sameer Shrivastava is a Solutions Architect at AWS, where he specializes in serverless technologies. He is enthusiastic about guiding organizations in their cloud transformation journeys to drive efficiency and scalability.

Urvi Sharma is a Solutions Architect at AWS who is passionate about working on edge services. She works with customers in the early stages of cloud adoption to help them migrate and modernize, and build resilient and secure architectures and incorporate AI/ML services with modern technologies like generative AI.