Carry out clever search throughout emails in your Google workspace utilizing the Gmail connector for Amazon Kendra

Many organizations use Gmail for his or her enterprise electronic mail wants. Gmail for Enterprise is a part of Google Workspace, which offers a set of productiveness and collaboration instruments like Google Drive, Google Docs, Google Sheets, and extra. For any group, emails include a wealth of data, which might be throughout the topic of an electronic mail, the message content material, and even electronic mail attachments. Performing an clever search on electronic mail interactions with coworkers can assist discover solutions to questions, thereby enhancing worker productiveness and enhancing the general buyer expertise for the group.

Amazon Kendra is a extremely correct and clever search service that permits your customers to go looking unstructured and structured information utilizing pure language processing (NLP) and superior search algorithms. Now you can use the Gmail connector for Amazon Kendra to index emails and electronic mail attachments in Gmail, and seek for solutions to your questions on this content material utilizing clever search in Amazon Kendra, powered by machine studying (ML).

This submit walks you thru the method of configuring the Gmail connector for Amazon Kendra on your group’s Google Workspace, permitting you to index emails primarily based on an outlined scope and reap the benefits of the clever search capabilities of Amazon Kendra.

Answer overview

A information supply is an information repository or location that Amazon Kendra connects to and indexes your paperwork or content material. After you create an Amazon Kendra index, you may create one or many information sources and configure them to begin ingesting paperwork from the information supply. In our resolution, we ingest emails and attachments from Gmail by configuring the brand new Gmail information supply connector to filter for emails that meet a sure filter criterion. After the configuration is full, we will synchronize the information supply to index the paperwork, permitting you to carry out clever search on the Amazon Kendra index.


To allow the Gmail connector for Amazon Kendra, you want the next:

  • An AWS account
  • A Google Workspace account and a company for what you are promoting with one or many customers which have entry to Gmail
  • Administrator account credentials to Google Workspace and the Google Cloud console

Configure Google Workspace

To allow Amazon Kendra to entry and index emails from Gmail accounts throughout the group and carry out clever search on them, it’s important to configure your group’s Google Workspace. Within the steps that comply with, we create a service account that the Gmail connector makes use of to index emails. The service account is supplied with authorization scopes to permit entry to sure Gmail APIs. The authorization scopes specific the permissions you request customers to authorize on your app and are relevant for all emails inside your group’s Google Workspace.

  1. Log in to your group’s Google Cloud account.
  2. Create a brand new undertaking with an applicable identify and assign it to your group. In our instance, we identify the undertaking KendraGmailConnector.
  3. Select Create.

  1. Monitor the progress of creation of the brand new undertaking on the Notifications menu on the highest proper of the Google Cloud console.

  1. After the undertaking is created, select the choices menu, select API & Providers¸ and select Library to view the API Library.

  1. On the API Library, seek for Admin SDK API and select Allow. The Admin SDK API permits managing the Google Workspace account sources and audit utilization.

  1. Equally, seek for Gmail API on the API Library web page and select Allow. The Gmail API can assist in viewing and managing Gmail mailbox information like threads, messages, and labels.

We now create a service account, which the Gmail connector for Amazon Kendra makes use of to entry your group’s emails primarily based on the allowed API scope.

  1. On the choices menu, select IAM & Admin, then select Service Accounts.

  1. Select Create service account.

  1. Enter a reputation on your service account. For this submit, we identify our service account AmazonKendraGmailConnector.
  2. Enter your service account ID and account description.
  3. Skip the non-obligatory steps Grant this service account entry to undertaking and Grant customers entry to this service account and select Completed.

  1. Select the service account you created to open the service account particulars web page.
  2. Observe the distinctive ID for the service account (also called a consumer ID), to make use of in a later step.

Subsequent, we create keys for the service account, which permits it for use by the Gmail connector for Amazon Kendra.

  1. On the Keys tab, select Add key.

  1. For Key kind, choose JSON.
  2. Select Create.

This step downloads the personal key to your laptop, which have to be stored secure to permit configuration on the Amazon Kendra console.

  1. Select Shut.

The next screenshot reveals an instance of the credentials JSON file.

  1. On the Particulars tab, increase the Superior settings part.
  2. Below Area-wide delegation, select View Google Workspace admin console.

Granting entry to the service account through a domain-wide delegation to your group’s information have to be accomplished with warning, and could be reversed by disabling or deleting the service account or eradicating entry by means of the Google Workspace admin console.

  1. Log in to the admin console utilizing your Google Workspace admin credentials.
  2. Within the navigation pane, beneath Safety, select Entry and information management, then select API controls.
  3. Within the Area-wide delegation part, select Handle domain-wide delegation.

  1. Select Add new.

This brings up the Add a brand new consumer ID dialog.

  1. Enter the distinctive ID for the service account you created earlier, and enter the next scopes to permit the service account to entry the emails from Gmail:
  2. Select Authorize.

This concludes the configuration throughout the Google Cloud console and Google Workspace admin console.

Configure the Gmail connector for Amazon Kendra

On this part, we stroll by means of the configuration steps for the Gmail connector for Amazon Kendra:

  1. On the Amazon Kendra console, create a new index or open an present index. For this submit, we use the present index EnterpriseKendraIndex.

  1. Below Information administration within the navigation pane, select Information sources.
  2. Select Add information supply.

  1. On the listing of information sources, discover the Gmail connector and select Add connector.

  1. On the Specify information supply particulars web page, full the next steps:
    1. For Information supply identify, enter a reputation.
    2. For Description, enter an non-obligatory description.
    3. Depart the language because the default setting, English (en).

    Amazon Kendra helps a choose set of languages with full semantic search. These languages embody Spanish, Japanese, French, and others. For extra data, see Adding documents in languages other than English.

    1. Add any tags to the index, then select Subsequent.

Subsequent, we create an AWS Secrets Manager secret to retailer the Gmail authentication particulars, and use the values within the credentials JSON file that we downloaded earlier.

  1. On the Outline entry and safety web page, full the next steps:
      1. Within the Authentication part, select Create and add new secret, which opens the Create an AWS Secrets and techniques Supervisor secret dialog.
      2. For Secret identify, enter a reputation.
      3. For Consumer electronic mail, enter the consumer electronic mail ID from the credentials JSON file.
      4. For Admin account electronic mail, enter the admin electronic mail for the Google Cloud console.
      5. For Non-public key, enter the personal key from the credentials JSON file.
      6. Select Save to return to the Outline entry and safety web page.

      1. Within the Configure VPC and safety group part, you may select a VPC and the subnets that can include the information supply and safety group that can grant entry to the host. For our configuration, we select No VPC.
      2. Within the IAM function part, select Create a brand new function and enter a job identify.
      3. Select Subsequent.

  1. On the Configure sync settings web page, set the next parameters to sync all emails and electronic mail attachments despatched from the admin electronic mail handle:
    1. Within the Sync scope part, choose Message attachments.
    2. Below Extra configuration, configure filters for the emails to ingest into the Amazon Kendra index:
      1. For Date vary, enter the beginning and finish dates for emails to be crawled. Emails obtained on or after the beginning date and earlier than the top date are included within the sync scope.
      2. For Electronic mail domains, enter the e-mail from domains, electronic mail to domains, topic, CC, and BCC emails you want to embody or exclude in your index. For this submit, we set the e-mail from area because the admin electronic mail handle.
      3. For Key phrases in topics, embody or exclude any paperwork with no less than one key phrase talked about of their topics.
      4. For Labels, add common expression patterns to incorporate or exclude sure labels or attachment varieties (as much as 100 patterns).
      5. For Attachments, add common expression patterns to incorporate or exclude sure attachments (as much as 100 patterns).

    1. Within the Sync mode part, you may both specify a full sync to sync and index all contents in all entities whatever the earlier sync standing, or solely sync new, modified, or deleted content material. For this submit, we choose Full sync.

    1. Lastly, we set an applicable frequency for the sync. For this submit, we select Run on demand.
    2. Select Subsequent.
  1. On the Set subject mappings web page, you affiliate or create a mapping of the required information supply fields with fields in your index. You may as well create mappings for customized index fields. You possibly can specify mapping for each messages and message attachments. For this submit, we add subject mappings within the Message part:
    1. Choose the Gmail subject mappings topic, from, and to.
    2. Select Subsequent.

  1. On the Evaluate and create web page, evaluation all of the steps and select Add information supply to create your Gmail connector information supply.
  2. After the information supply is created, on the Information sources web page, choose the information supply (kendra-gmail-connector) and select Sync now.

The period of time the sync takes is dependent upon the variety of the emails that match the sync scope and the scale of attachments that want be listed. You possibly can examine the standing of the sync operation for the Gmail information supply if you happen to select the information supply and scroll right down to the Sync run historical past part. Select the standing of the person sync to view extra particulars.

This part reveals the beginning and finish occasions of the sync and likewise the variety of paperwork that had been added, deleted, failed, or modified through the sync. A standing of Accomplished denotes a sync the place there aren’t any failures. In instances the place a doc being ingested is clean, the sync standing is about to Accomplished with Errors with the variety of failed paperwork listed as Failed, as proven within the following screenshot. In case of a sync failure, you may examine the explanation by both selecting the variety of failed paperwork or by selecting the entry within the Particulars column, which brings up the Amazon CloudWatch logs. Within the following instance, two paperwork failed ingestion as a result of they had been clean.

After the sync is profitable, you may carry out a search on the Amazon Kendra index.

Search listed content material

To go looking on the listed content material, select Search listed content material within the navigation pane on the Amazon Kendra console.

On the search console, enter any pure language query. In our instance, we ask “What’s SageMaker.” Amazon Kendra performs an clever search on the emails ingested into the index primarily based on the scope of the sync and finds a solution, as proven within the following screenshot.

On this instance, the Doc fields part reveals the sector mappings that we specified whereas configuring our information supply connector.

Clear up

To keep away from incurring future prices, clear up the sources you created as a part of this resolution. In case you created a brand new Amazon Kendra index whereas testing this resolution, delete it. In case you solely added a brand new information supply utilizing the Gmail connector, delete the added information supply.


On this submit, we confirmed how organizations can now use the Gmail connector for Amazon Kendra to permit customers to carry out clever search on emails and electronic mail attachments, thereby enhancing worker productiveness and buyer satisfaction.

Moreover, we walked by means of methods to outline subject mappings to the Amazon Kendra information supply, permitting customers to refine their search outcomes.

To study extra in regards to the Gmail connector for Amazon Kendra, seek advice from Gmail information supply connector for Amazon Kendra.

In regards to the Creator

Roshan Thomas is a Senior Options Architect at Amazon Internet Providers. He’s primarily based in Melbourne, Australia, and works carefully with energy and utilities prospects to speed up their journey within the cloud. He’s enthusiastic about expertise and serving to prospects architect and construct options on AWS.

Leave a Reply

Your email address will not be published. Required fields are marked *