

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Amazon Keyspace에서 키스페이스 생성
<a name="getting-started.keyspaces"></a>

이 섹션에서는 콘솔, `cqlsh` 또는 AWS CLI를 사용하여 키스페이스를 생성합니다.

**참고**  
시작하기 전에 [자습서 사전 조건](getting-started.before-you-begin.md)을 모두 구성해야 합니다.

*키스페이스*는 하나 이상의 애플리케이션과 관련된 관련 테이블을 그룹화합니다. 키스페이스는 하나 이상의 테이블을 포함하며 포함된 모든 테이블의 복제 전략을 정의합니다. 키스페이스에 대한 자세한 내용은 다음 주제를 참조하세요.
+ CQL 언어 참조의 데이터 정의 언어(DDL) 문: [Keyspaces](cql.ddl.keyspace.md)
+ [Amazon Keyspaces(Apache Cassandra용)에 대한 할당량](quotas.md)

이 자습서에서는 단일 리전 키스페이스를 생성하고 키스페이스의 복제 전략은 `SingleRegionStrategy`입니다. Amazon Keyspaces는 `SingleRegionStrategy`를 사용하여 하나의 AWS 리전에서 3개의 [가용 영역](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/)에 데이터를 복제합니다. 다중 리전 키스페이스를 생성하는 방법을 알아보려면 [Amazon Keyspaces에서 다중 리전 키스페이스 생성](keyspaces-mrr-create.md) 섹션을 참조하세요.

## 콘솔 사용
<a name="getting-started.keyspaces.con"></a>

**콘솔을 사용하여 키스페이스를 생성하려면**

1. 에 로그인 AWS Management Console하고 [https://console.aws.amazon.com/keyspaces/home](https://console.aws.amazon.com/keyspaces/home) Amazon Keyspaces 콘솔을 엽니다.

1. 탐색 창에서 **Keyspaces**를 선택합니다.

1. **키스페이스 생성**을 선택합니다.

1. **키스페이스 이름** 상자에 키스페이스 이름으로 **catalog**를 입력합니다.

   **이름 제약 조건:**
   + 이름은 비워둘 수 없습니다.
   + 허용되는 문자: 영숫자 및 밑줄(`_`)
   + 최대 길이는 48자입니다.

1. **AWS 리전**에서 **단일 리전 복제**가 키스페이스의 복제 전략인지 확인합니다.

1. 키스페이스를 만들려면 **키스페이스 생성**을 선택합니다.

1. 다음을 수행하여 `catalog` 키스페이스가 생성되었는지 확인합니다.

   1. 탐색 창에서 **Keyspaces**를 선택합니다.

   1. 키스페이스 목록에서 `catalog` 키스페이스를 찾습니다.

## CQL 사용
<a name="getting-started.keyspaces.cql"></a>

다음 절차는 CQL을 사용하여 키스페이스를 생성합니다.

**CQL을 사용하여 키스페이스를 만들려면**

1. 를 AWS CloudShell 열고 다음 명령을 사용하여 Amazon Keyspaces에 연결합니다. *us-east-1*을 자체 리전으로 업데이트해야 합니다.

   ```
   cqlsh-expansion cassandra.us-east-1.amazonaws.com 9142 --ssl
   ```

   해당 명령의 결과는 다음과 같아야 합니다.

   ```
   Connected to Amazon Keyspaces at cassandra.us-east-1.amazonaws.com:9142
   [cqlsh 6.1.0 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
   Use HELP for help.
   cqlsh current consistency level is ONE.
   ```

1. 다음 CQL 명령을 사용하여 키스페이스를 생성합니다.

   ```
   CREATE KEYSPACE catalog WITH REPLICATION = {'class': 'SingleRegionStrategy'};
   ```

   `SingleRegionStrategy`는 복제 인수 3을 사용하고 해당 리전의 AWS 가용 영역 3개에 데이터를 복제합니다.
**참고**  
Amazon Keyspaces는 따옴표로 입력하지 않는 한 기본적으로 모든 입력을 소문자로 사용합니다.

1. 키스페이스가 생성되었는지 확인합니다.

   ```
   SELECT * from system_schema.keyspaces;
   ```

   이 명령의 출력은 다음과 비슷해야 합니다.

   ```
   cqlsh> SELECT * from system_schema.keyspaces;
   
    keyspace_name           | durable_writes | replication
   -------------------------+----------------+-------------------------------------------------------------------------------------
              system_schema |           True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'}
          system_schema_mcs |           True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'}
                     system |           True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'}
    system_multiregion_info |           True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'}
                    catalog |           True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'}
   
   (5 rows)
   ```

## 사용 AWS CLI
<a name="getting-started.keyspaces.cli"></a>

다음 절차는 AWS CLI를 사용하여 키스페이스를 생성합니다.

**를 사용하여 키스페이스를 생성하려면 AWS CLI**

1. 환경이 설정되었는지 확인하기 위해 CloudShell에서 다음 명령을 실행할 수 있습니다.

   ```
   aws keyspaces help
   ```

1. 다음 AWS CLI 문을 사용하여 키스페이스를 생성합니다.

   ```
   aws keyspaces create-keyspace --keyspace-name 'catalog'
   ```

1. 다음 AWS CLI 문을 사용하여 키스페이스가 생성되었는지 확인합니다.

   ```
   aws keyspaces get-keyspace --keyspace-name 'catalog'
   ```

   이 명령의 출력은 이 예제와 비슷해야 합니다.

   ```
   {
       "keyspaceName": "catalog",
       "resourceArn": "arn:aws:cassandra:us-east-1:111122223333:/keyspace/catalog/",
       "replicationStrategy": "SINGLE_REGION"
   }
   ```