Menu
Amazon Rekognition
Developer Guide

Step 2: Set Up the AWS Command Line Interface (AWS CLI)

Follow the steps to download and configure the AWS Command Line Interface (AWS CLI).

Important

You don't need the AWS CLI to perform the steps in the Getting Started exercise. However, some of the exercises in this guide use the AWS CLI. You can skip this step and go to Step 4: Getting Started Using the API, and then set up the AWS CLI later when you need it.

To set up the AWS CLI

  1. Download and configure the AWS CLI. For instructions, see the following topics in the AWS Command Line Interface User Guide:

  2. Add a named profile for the administrator user in the AWS CLI config file. You use this profile when executing the AWS CLI commands. For more information about named profiles, see Named Profiles in the AWS Command Line Interface User Guide.

    [profile adminuser] aws_access_key_id = adminuser access key ID aws_secret_access_key = adminuser secret access key region = aws-region

    For a list of available AWS regions, see Regions and Endpoints in the Amazon Web Services General Reference.

  3. Verify the setup by entering the following help command at the command prompt:

    aws help

Formatting the AWS CLI Examples

The AWS CLI examples are formatted for the Linux operating system. To use the samples with Microsoft Windows, you will need to change the JSON formatting of the --image parameter and change the line breaks from backslashes (\) to carets(^). For more information about JSON formatting, see Specifying Parameter Values for the AWS Command Line Interface. The following is an example AWS CLI command formatted for Microsoft Windows.

aws rekognition detect-labels ^ --image "{\"S3Object\":{\"Bucket\":\"photo-collection\",\"Name\":\"photo.jpg\"}}" ^ --region us-west-2

You can also provide a shorthand version of the JSON that works on both Microsoft Windows and Linux.

aws rekognition detect-labels --image "S3Object={Bucket=photo-collection,Name=photo.jpg}" --region us-west-2

For more information, see Using Shorthand Syntax with the AWS Command Line Interface.

Next Step

Step 4: Getting Started Using the API

On this page: