---
source_url: "https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/"
title: Connect to Amazon Rekognition for Image Analysis APIs - AWS Amplify Gen 2 Documentation
mirrored_at: 2026-08-30T03:02:21.542Z
host: docs.amplify.aws
cited_in_42a: true
mirror_canonical: "https://index.42a.ai/docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/index"
---

> **Original source:** https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/

**Amazon Rekognition** is an advanced machine learning service provided by Amazon Web Services (AWS), allowing developers to incorporate image and video analysis into their applications. It uses state-of-the-art machine learning models to analyze images and videos, providing valuable insights such as object and scene detection, text recognition, face analysis, and more.

Key features of Amazon Rekognition include:

-   **Object and Scene Detection**: Amazon Rekognition can identify thousands of objects and scenes in images and videos, providing valuable context for your media content.
    
-   **Text Detection and Recognition**: The service can detect and recognize text within images and videos, making it an invaluable tool for applications requiring text extraction.
    
-   **Facial Analysis**: Amazon Rekognition offers accurate facial analysis, enabling you to detect, analyze, and compare faces in images and videos.
    
-   **Facial Recognition**: You can build applications with the capability to recognize and verify individuals using facial recognition.
    
-   **Content Moderation**: Amazon Rekognition can analyze images and videos to identify inappropriate or objectionable content, helping you maintain safe and compliant content.
    

In this section, you will learn how to integrate Amazon Rekognition into your application using AWS Amplify, leveraging its powerful image analysis capabilities seamlessly.

## [Step 1 - Set up the project](https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/#step-1---set-up-the-project)

Set up your project by following the instructions in the [Quickstart guide](https://docs.amplify.aws/react/start/quickstart/).

## [Step 2 - Install Rekognition Libraries](https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/#step-2---install-rekognition-libraries)

Create a new API endpoint that'll use the the AWS SDK to call the Amazon Rekognition service. To install the Amazon Rekognition SDK, run the following command in your project's root folder:

## [Step 3 - Setup Storage](https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/#step-3---setup-storage)

Create a file named `amplify/storage/resource.ts` and add the following content to configure a storage resource:

## [Step 4 - Add your Amazon Rekognition as Datasource](https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/#step-4---add-your-amazon-rekognition-as-datasource)

To use the Amazon Rekognition service, you need to add Amazon Rekognition as an HTTP Data Source and configure the proper IAM policy for Lambda to effectively utilize the desired feature and grant permission to access the storage. In this case, you can add the `rekognition:DetectText` and `rekognition:DetectLabels` actions to the policy. Update the `amplify/backend.ts` file as shown below.

## [Step 5 - Configure the function handler](https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/#step-5---configure-the-function-handler)

Define the function handler by creating a new file, `amplify/data/identifyText.js`. This function analyzes the image and extracts text using the Amazon Rekognition DetectText service.

## [Step 6 - Define the custom query](https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/#step-6---define-the-custom-query)

After adding Amazon Rekognition as a data source, you can reference it in custom query using the `a.handler.custom()` modifier, which takes the name of the data source and an entry point for your resolvers. In your `amplify/data/resource.ts` file, specify `RekognitionDataSource` as the data source and `identifyText.js` as the entry point, as shown below.

## [Step 7 - Update Storage permissions](https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/#step-7---update-storage-permissions)

Customize your storage settings to manage access to various paths within your storage bucket. Modify the file `amplify/storage/resource.ts` as shown below.

## [Step 8 - Configure the frontend](https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/#step-8---configure-the-frontend)

Import and load the configuration file in your app. It's recommended you add the Amplify configuration step to your app's root entry point.

### [Invoke the Text Recognition API](https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-amazon-rekognition/#invoke-the-text-recognition-api)

This code sets up a React app to upload an image to an S3 bucket and then use Amazon Rekognition to recognize the text in the uploaded image.