Search code examples
amazon-web-servicesamazon-s3aws-cliamazon-rekognition

Calling Rekognition using AWS CLI


I have the AWS CLI installed on Windows and am using the Windows command prompt.

I am trying to use Rekognition but I cannot seem to get any commands working. The closest I have gotten is with:

aws rekognition detect-faces --image S3Object=\{Bucket=innovation-bucket,Name=image.jpg,Version=1\} --attributes "ALL" --region us-east-1

This results in:

Error parsing parameter '--image': Expected: ',', received: '}' for input: S3Object={Bucket=innovation-bucket,Name=image.jpg,Version=1}

Why is it expecting a comma?

EDIT:

When I try the format from the documentation I also get errors:

aws rekognition detect-faces --image '{"S3Object":{"Bucket":"innovation-bucket","Name":"image.jpg"}}' --attributes "ALL" --region us-east-1

Error parsing parameter '--image': Expected: '=', received ''' for input: '{"S3Object":{"Bucket":"innovation-bucket","Name":"image.jpg‌​"}}'


Solution

  • 1) Your AWS CLI should be something like below, refer this documentation:

    aws rekognition search-faces-by-image \
    --image '{"S3Object":{"Bucket":"bucket-name","Name":"Example.jpg"}}' \
    --collection-id "collection-id" \
    --region us-east-1 \
    --profile adminuser
    

    2) If your AWS CLI installed on windows box, make sure you change "the single quotes to double quotes and the double quotes to escaped quotes"