Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Getting started (AWS CLI)

Focus mode
Getting started (AWS CLI) - Amazon Translate

In the following exercise, you use the AWS command line interface (AWS CLI) to translate text. To complete the exercise, you need to be familiar with the CLI and have a text editor. For more information, see Install and configure the AWS Command Line Interface (AWS CLI).

To use Amazon Translate from the command line, you need to run the command from a region that supports the Amazon Translate service. For a list of available endpoints and regions, see Amazon Translate Regions and Endpoints in the AWS General Reference.

Translate text using the command line

The following example shows how to use the TranslateText operation from the command line to translate text. The example is formatted for Unix, Linux, and macOS. For Windows, replace the backslash (\) Unix continuation character at the end of each line with a caret (^). At the command line, type the following.

aws translate translate-text \ --region region \ --source-language-code "en" \ --target-language-code "es" \ --text "hello, world"

The response is the following JSON:

{ "TargetLanguageCode": "es", "Text": "Hola, mundo", "SourceLanguageCode": "en" }

Next step

To see other ways to use Amazon Translate see Code examples for Amazon Translate using AWS SDKs.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.