Amazon Translate
Developer Guide

Logging Amazon Translate API Calls with AWS CloudTrail

Amazon Translate is integrated with AWS CloudTrail, a service that provides a record of actions taken by an IAM user, IAM role, or AWS service in Amazon Translate. CloudTrail captures all API calls for Amazon Translate as events. This includes calls from the Amazon Translate console and code calls to the Amazon Translate API operations. If you create a CloudTrail trail, you can enable continuous delivery of CloudTrail events, including events for Amazon Translate, to an Amazon Simple Storage Service (Amazon S3) bucket. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history. You can use the information collected by CloudTrail to determine the request that was made to Amazon Translate, the IP address from which the request was made, who made the request, when it was made, and additional details.

To learn more about CloudTrail, see the AWS CloudTrail User Guide.

Amazon Translate Information in CloudTrail

CloudTrail is enabled on your AWS account when you create the account. When activity occurs in Amazon Translate, that activity is recorded in a CloudTrail event along with other AWS service events in Event history. You can view, search, and download recent events in your AWS account. For more information, see Viewing Events with CloudTrail Event History.

For an ongoing record of events in your AWS account, including events for Amazon Translate, create a trail. A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail with the console, the trail applies to all AWS Regions. The trail logs events from all Regions in the AWS partition and delivers the log files to the S3 bucket that you specify. You can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following:

All Amazon Translate actions are logged by CloudTrail and are documented in the API reference section. For example, calls to the DeleteTerminology, ImportTerminology and TranslateText actions generate entries in the CloudTrail log files.

Every event or log entry contains information about who generated the request. This information helps you determine the following:

  • Whether the request was made with root or AWS Identity and Access Management (IAM) user credentials

  • Whether the request was made with temporary security credentials for a role or federated user

  • Whether the request was made by another AWS service

For more information, see the CloudTrail userIdentity Element.

Understanding Amazon Translate Log File Entries

A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so they don't appear in any specific order.

The following example shows a CloudTrail log entry that demonstrates the TranslateText action.

{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "AIDACKCEVSQ6C2EXAMPLE", "arn": "arn:aws:iam::111122223333:user/Administrator", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "Administrator" }, "eventTime": "2019-09-03T20:32:50Z", "eventSource": "translate.amazonaws.com", "eventName": "TranslateText", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.0", "userAgent": "aws-cli/1.16.207 Python/3.4.7 Linux/4.9.184-0.1.ac.235.83.329.metal1.x86_64 botocore/1.12.197", "requestParameters": { "text": "Amazon is based in Seattle.", "sourceLanguageCode": "en", "targetLanguageCode": "fr" }, "responseElements": { "translatedText": "Amazon est basé à Seattle.", "sourceLanguageCode": "en", "targetLanguageCode": "fr" }, "requestID": "f56da956-284e-4983-b6fc-59befa20e2bf", "eventID": "1dc75278-84d7-4bb2-861a-493d08d67391", "eventType": "AwsApiCall", "recipientAccountId": "111122223333" }