기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
인덱스 생성
콘솔을 사용하거나 CreateIndexAPI를 호출하여 색인을 생성할 수 있습니다. API와 함께 AWS Command Line Interface (AWS CLI) 또는 SDK를 사용할 수 있습니다. 인덱스를 만든 후 인덱스에 직접 또는 데이터 소스에서 문서를 추가할 수 있습니다.
인덱스를 생성하려면 인덱스가 액세스할 수 있는 () 역할의 Amazon 리소스 이름 AWS Identity and Access Management (ARNIAM) 을 제공해야 합니다. CloudWatch 자세한 내용은 인덱스에 대한 IAM 역할을 참조하세요.
다음 탭은 AWS Management Console,,, Python 및 Java SDK를 사용하기 위한 코드 예제를 사용하여 색인을 생성하는 절차를 제공합니다. AWS CLI
- Console
-
인덱스를 만들려면
-
AWS 관리 콘솔에 로그인하고 https://console.aws.amazon.com/kendra/
에서 Amazon Kendra 콘솔을 엽니다. -
인덱스 섹션에서 인덱스 생성을 선택합니다.
-
인덱스 세부정보 지정 페이지에서 인덱스 이름과 설명을 입력합니다.
-
IAM 역할에서 IAM 역할을 제공하십시오. 역할을 찾으려면 계정에서 “kendra”라는 단어가 포함된 역할 중에서 선택하거나 다른 역할의 이름을 입력하세요. 역할에 필요한 권한에 대한 자세한 내용은 인덱스에 대한 IAM 역할을 참조하세요.
-
다음을 선택합니다.
-
사용자 액세스 제어 구성 페이지에서 다음을 선택합니다. 인덱스를 만든 후 액세스 제어에 토큰을 사용하도록 인덱스를 업데이트할 수 있습니다. 자세한 내용은 문서에 대한 액세스 제어를 참조하세요.
-
프로비저닝 세부 정보 페이지에서 생성을 선택합니다.
-
인덱스를 생성하는 데 시간이 걸릴 수 있습니다. 인덱스 목록을 확인하여 인덱스 생성 진행 상황을 확인하세요. 인덱스 상태가
ACTIVE
가 되면 인덱스를 사용할 준비가 된 것입니다.
-
- AWS CLI
-
색인을 만들려면
-
다음 명령을 사용하여 인덱스를 생성합니다. 는 작업을 실행할 Amazon Kendra 수 있는 IAM 역할의 Amazon 리소스 이름 (ARN)
role-arn
이어야 합니다. 자세한 내용은 IAM 역할을 참조하세요.이 명령은 Linux 및 macOS용으로 형식이 지정됩니다. Windows를 사용하는 경우 Unix 줄 연속 문자(\)를 캐럿(^)으로 바꿉니다.
aws kendra create-index \ --name
index name
\ --description "index description
" \ --role-arn arn:aws:iam::account ID
:role/role name
-
인덱스를 생성하는 데 시간이 걸릴 수 있습니다. 인덱스 상태를 확인하려면
create-index
에서 반환한 인덱스 ID를 다음 명령과 함께 사용하세요. 인덱스 상태가ACTIVE
가 되면 인덱스를 사용할 준비가 된 것입니다.aws kendra describe-index \ --index-id
index ID
-
- Python
-
인덱스를 만들려면
-
다음 코드 예제에 다음 변수의 값을 입력합니다.
-
description
- 생성 중인 인덱스에 대한 설명입니다. 이는 선택 사항입니다. -
index_name
- 생성 중인 인덱스의 이름입니다. -
role_arn
—API를 실행할 수 Amazon Kendra 있는 역할의 Amazon 리소스 이름 (ARN). 자세한 내용은 IAM 역할을 참조하세요.
import boto3 from botocore.exceptions import ClientError import pprint import time kendra = boto3.client("kendra") print("Create an index.") # Provide a name for the index index_name = "index-name" # Provide an optional description for the index description = "index description" # Provide the IAM role ARN required for indexes role_arn = "arn:aws:iam::${account id}:role/${role name}" try: index_response = kendra.create_index( Name = index_name, Description = description, RoleArn = role_arn ) pprint.pprint(index_response) index_id = index_response["Id"] print("Wait for Amazon Kendra to create the index.") while True: # Get the details of the index, such as the status index_description = kendra.describe_index( Id = index_id ) # If status is not CREATING, then quit status = index_description["Status"] print(" Creating index. Status: "+status) if status != "CREATING": break time.sleep(60) except ClientError as e: print("%s" % e) print("Program ends.")
-
-
- Java
-
인덱스를 만들려면
-
다음 코드 예제에 다음 변수의 값을 입력합니다.
-
description
- 생성 중인 인덱스에 대한 설명입니다. 이는 선택 사항입니다. -
index_name
- 생성 중인 인덱스의 이름입니다. -
role_arn
—API를 실행할 수 Amazon Kendra 있는 역할의 Amazon 리소스 이름 (ARN). 자세한 내용은 IAM 역할을 참조하세요.
package com.amazonaws.kendra; import java.util.concurrent.TimeUnit; import software.amazon.awssdk.services.kendra.KendraClient; import software.amazon.awssdk.services.kendra.model.CreateIndexRequest; import software.amazon.awssdk.services.kendra.model.CreateIndexResponse; import software.amazon.awssdk.services.kendra.model.DescribeIndexRequest; import software.amazon.awssdk.services.kendra.model.DescribeIndexResponse; import software.amazon.awssdk.services.kendra.model.IndexStatus; public class CreateIndexExample { public static void main(String[] args) throws InterruptedException { String indexDescription = "Getting started index for Kendra"; String indexName = "java-getting-started-index"; String indexRoleArn = "arn:aws:iam::<your AWS account ID>:role/KendraRoleForGettingStartedIndex"; System.out.println(String.format("Creating an index named %s", indexName)); CreateIndexRequest createIndexRequest = CreateIndexRequest .builder() .description(indexDescription) .name(indexName) .roleArn(indexRoleArn) .build(); KendraClient kendra = KendraClient.builder().build(); CreateIndexResponse createIndexResponse = kendra.createIndex(createIndexRequest); System.out.println(String.format("Index response %s", createIndexResponse)); String indexId = createIndexResponse.id(); System.out.println(String.format("Waiting until the index with ID %s is created.", indexId)); while (true) { DescribeIndexRequest describeIndexRequest = DescribeIndexRequest.builder().id(indexId).build(); DescribeIndexResponse describeIndexResponse = kendra.describeIndex(describeIndexRequest); IndexStatus status = describeIndexResponse.status(); if (status != IndexStatus.CREATING) { break; } TimeUnit.SECONDS.sleep(60); } System.out.println("Index creation is complete."); } }
-
-
인덱스를 만든 후 인덱스에 문서를 추가합니다. 직접 추가하거나 정기적으로 인덱스를 업데이트하는 데이터 소스를 만들 수 있습니다.