

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

# Cassandra 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
<a name="programmatic.drivers"></a>

많은 타사 오픈 소스 Cassandra 드라이버를 사용하여 Amazon Keyspaces에 접속할 수 있습니다. Amazon Keyspaces는 Apache Cassandra 버전 3.11.2를 지원하는 Cassandra 드라이버와 호환됩니다. Amazon Keyspaces에서 테스트하고 사용할 것을 권장하는 드라이버와 최신 버전은 다음과 같습니다.
+ `Java v3.3`
+ `Java v4.17`
+ `Python Cassandra-driver 3.29.1`
+ `Node.js cassandra driver -v 4.7.2`
+ `GO using GOCQL v1.6`
+ `.NET CassandraCSharpDriver -v 3.20.1`

Cassandra 드라이버에 대한 자세한 내용은 [Apache Cassandra Client 드라이버](http://cassandra.apache.org/doc/latest/getting_started/drivers.html)를 참조하세요.

**참고**  
시작하는 데 도움이 되도록 인기 있는 드라이버를 통한 Amazon Keyspace에 대한 연결을 설정하는 엔드 투 엔드 코드 예제를 보고 다운로드할 수 있습니다. GitHub에서 [Amazon Keyspaces 예제](https://github.com/aws-samples/amazon-keyspaces-examples)를 참조하세요.

이 장의 튜토리얼에는 Amazon Keyspace에 대한 연결이 성공적으로 설정되었는지 확인하는 간단한 CQL 쿼리가 포함되어 있습니다. Amazon Keyspaces 엔드포인트에 연결한 후 키스페이스 및 테이블을 사용하는 방법을 알아보려면 [Amazon Keyspaces(Apache Cassandra용)에 대한 CQL 언어 참조](cql.md)을 참조하세요. Amazon VPC 엔드포인트에서 Amazon Keyspaces에 접속하는 방법을 보여주는 단계별 튜토리얼은 [자습서: 인터페이스 VPC 엔드포인트를 사용하여 Amazon Keyspaces에 연결](vpc-endpoints-tutorial.md) 섹션을 참조하세요.

**Topics**
+ [

# Cassandra Java 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
](using_java_driver.md)
+ [

# Cassandra Python 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
](using_python_driver.md)
+ [

# Cassandra Node.js 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
](using_nodejs_driver.md)
+ [

# Cassandra. NET Core 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
](using_dotnetcore_driver.md)
+ [

# Cassandra Go 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
](using_go_driver.md)
+ [

# Cassandra Perl 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
](using_perl_driver.md)

# Cassandra Java 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
<a name="using_java_driver"></a>

이 섹션에서는 Java 클라이언트 드라이버를 사용하여 Amazon Keyspaces에 접속하는 방법을 소개합니다.

**참고**  
Java 17 및 DataStax Java 드라이버 4.17은 현재 베타 지원에서만 사용할 수 있습니다. 자세한 내용은 [https://docs.datastax.com/en/developer/java-driver/4.17/upgrade_guide/](https://docs.datastax.com/en/developer/java-driver/4.17/upgrade_guide/) 단원을 참조하십시오.

Amazon Keyspaces 리소스에 프로그래밍 방식으로 액세스할 수 있는 자격 증명을 사용자와 애플리케이션에 제공하려면 다음 중 하나를 수행할 수 있습니다.
+ 특정 AWS Identity and Access Management (IAM) 사용자와 연결된 서비스별 자격 증명을 생성합니다.
+ 보안을 강화하려면 모든 AWS 서비스에서 사용되는 IAM 자격 증명에 대한 IAM 액세스 키를 생성하는 것이 좋습니다. Cassandra 클라이언트 드라이버용 Amazon Keyspaces SigV4 인증 플러그인을 사용하면 사용자 이름 및 암호 대신 IAM 액세스 키를 사용하여 Amazon Keyspaces에 대한 호출을 인증할 수 있습니다. 자세한 내용은 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md) 단원을 참조하십시오.

**참고**  
Spring Boot와 함께 Amazon Keyspaces를 사용하는 방법에 대한 예는 [https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/java/datastax-v4/spring](https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/java/datastax-v4/spring)을 참조하세요.

**Topics**
+ [

## 시작하기 전 준비 사항
](#using_java_driver.BeforeYouBegin)
+ [

## 서비스별 자격 증명을 사용하는 Apache Cassandra용 DataStax Java 드라이버를 사용하여 Amazon Keyspaces에 접속하는 단계별 튜토리얼
](#java_tutorial)
+ [

## Apache Cassandra용 4.x DataStax Java 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속하는 단계별 튜토리얼
](#java_tutorial.SigV4)
+ [

## Apache Cassandra용 4.x DataStax Java 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속
](#java3x_tutorial.SigV4)

## 시작하기 전 준비 사항
<a name="using_java_driver.BeforeYouBegin"></a>

Amazon Keyspaces에 접속하려면 시작하기 전에 다음 작업을 수행해야 합니다.

1. Amazon Keyspaces에서는 클라이언트와의 연결을 보호하는 데 도움이 되는 전송 계층 보안(TLS)을 사용해야 합니다.

   1.  다음 디지털 인증서를 다운로드하고 파일을 로컬 또는 홈 디렉터리에 저장합니다.

      1. AmazonRootCA1

      1. AmazonRootCA2

      1. AmazonRootCA3

      1. AmazonRootCA4

      1. Starfield 클래스 2 루트(선택 사항 - 이전 버전과의 호환성을 위해)

      인증서를 다운로드하려면 다음 명령을 사용할 수 있습니다.

      ```
      curl -O https://www.amazontrust.com/repository/AmazonRootCA1.pem
      curl -O https://www.amazontrust.com/repository/AmazonRootCA2.pem
      curl -O https://www.amazontrust.com/repository/AmazonRootCA3.pem
      curl -O https://www.amazontrust.com/repository/AmazonRootCA4.pem
      curl -O https://certs.secureserver.net/repository/sf-class2-root.crt
      ```
**참고**  
Amazon Keyspaces는 이전에 Starfield Class 2 CA에 고정된 TLS 인증서를 사용했습니다. AWS 는 Amazon Trust Services(Amazon Root CA 1\$14)에 따라 발급된 인증서 AWS 리전 로 모두 마이그레이션하고 있습니다. CAs 이 전환 중에 Amazon Root CAs1\$14와 Starfield 루트를 모두 신뢰하도록 클라이언트를 구성하여 모든 리전에서 호환성을 보장합니다.

   1. 디지털 인증서를 trustStore 파일로 변환하고 키 스토어에 추가합니다.

      ```
      openssl x509 -outform der -in AmazonRootCA1.pem -out temp_file.der
      keytool -import -alias amazon-root-ca-1 -keystore cassandra_truststore.jks -file temp_file.der
      
      openssl x509 -outform der -in AmazonRootCA2.pem -out temp_file.der
      keytool -import -alias amazon-root-ca-2 -keystore cassandra_truststore.jks -file temp_file.der
      
      openssl x509 -outform der -in AmazonRootCA3.pem -out temp_file.der
      keytool -import -alias amazon-root-ca-3 -keystore cassandra_truststore.jks -file temp_file.der
      
      openssl x509 -outform der -in AmazonRootCA4.pem -out temp_file.der
      keytool -import -alias amazon-root-ca-4 -keystore cassandra_truststore.jks -file temp_file.der
                   
      openssl x509 -outform der -in sf-class2-root.crt -out temp_file.der
      keytool -import -alias cassandra -keystore cassandra_truststore.jks -file temp_file.der
      ```

      마지막 단계에서는 키 스토어의 암호를 생성하고 각 인증서를 신뢰해야 합니다. 대화형 명령은 다음과 같습니다.

      ```
      Enter keystore password:  
      Re-enter new password: 
      Owner: CN=Amazon Root CA 1, O=Amazon, C=US
      Issuer: CN=Amazon Root CA 1, O=Amazon, C=US
      Serial number: 66c9fcf99bf8c0a39e2f0788a43e696365bca
      Valid from: Tue May 26 00:00:00 UTC 2015 until: Sun Jan 17 00:00:00 UTC 2038
      Certificate fingerprints:
           SHA1: 8D:A7:F9:65:EC:5E:FC:37:91:0F:1C:6E:59:FD:C1:CC:6A:6E:DE:16
           SHA256: 8E:CD:E6:88:4F:3D:87:B1:12:5B:A3:1A:C3:FC:B1:3D:70:16:DE:7F:57:CC:90:4F:E1:CB:97:C6:AE:98:19:6E
      Signature algorithm name: SHA256withRSA
      Subject Public Key Algorithm: 2048-bit RSA key
      Version: 3
      
      Extensions: 
      
      #1: ObjectId: 2.5.29.19 Criticality=true
      BasicConstraints:[
        CA:true
        PathLen:2147483647
      ]
      
      #2: ObjectId: 2.5.29.15 Criticality=true
      KeyUsage [
        DigitalSignature
        Key_CertSign
        Crl_Sign
      ]
      
      #3: ObjectId: 2.5.29.14 Criticality=false
      SubjectKeyIdentifier [
      KeyIdentifier [
      0000: 84 18 CC 85 34 EC BC 0C   94 94 2E 08 59 9C C7 B2  ....4.......Y...
      0010: 10 4E 0A 08                                        .N..
      ]
      ]
      
      Trust this certificate? [no]:  yes
      Certificate was added to keystore
      Enter keystore password:  
      Owner: CN=Amazon Root CA 2, O=Amazon, C=US
      Issuer: CN=Amazon Root CA 2, O=Amazon, C=US
      Serial number: 66c9fd29635869f0a0fe58678f85b26bb8a37
      Valid from: Tue May 26 00:00:00 UTC 2015 until: Sat May 26 00:00:00 UTC 2040
      Certificate fingerprints:
           SHA1: 5A:8C:EF:45:D7:A6:98:59:76:7A:8C:8B:44:96:B5:78:CF:47:4B:1A
           SHA256: 1B:A5:B2:AA:8C:65:40:1A:82:96:01:18:F8:0B:EC:4F:62:30:4D:83:CE:C4:71:3A:19:C3:9C:01:1E:A4:6D:B4
      Signature algorithm name: SHA384withRSA
      Subject Public Key Algorithm: 4096-bit RSA key
      Version: 3
      
      Extensions: 
      
      #1: ObjectId: 2.5.29.19 Criticality=true
      BasicConstraints:[
        CA:true
        PathLen:2147483647
      ]
      
      #2: ObjectId: 2.5.29.15 Criticality=true
      KeyUsage [
        DigitalSignature
        Key_CertSign
        Crl_Sign
      ]
      
      #3: ObjectId: 2.5.29.14 Criticality=false
      SubjectKeyIdentifier [
      KeyIdentifier [
      0000: B0 0C F0 4C 30 F4 05 58   02 48 FD 33 E5 52 AF 4B  ...L0..X.H.3.R.K
      0010: 84 E3 66 52                                        ..fR
      ]
      ]
      
      Trust this certificate? [no]:  yes
      Certificate was added to keystore
      Enter keystore password:  
      Owner: CN=Amazon Root CA 3, O=Amazon, C=US
      Issuer: CN=Amazon Root CA 3, O=Amazon, C=US
      Serial number: 66c9fd5749736663f3b0b9ad9e89e7603f24a
      Valid from: Tue May 26 00:00:00 UTC 2015 until: Sat May 26 00:00:00 UTC 2040
      Certificate fingerprints:
           SHA1: 0D:44:DD:8C:3C:8C:1A:1A:58:75:64:81:E9:0F:2E:2A:FF:B3:D2:6E
           SHA256: 18:CE:6C:FE:7B:F1:4E:60:B2:E3:47:B8:DF:E8:68:CB:31:D0:2E:BB:3A:DA:27:15:69:F5:03:43:B4:6D:B3:A4
      Signature algorithm name: SHA256withECDSA
      Subject Public Key Algorithm: 256-bit EC (secp256r1) key
      Version: 3
      
      Extensions: 
      
      #1: ObjectId: 2.5.29.19 Criticality=true
      BasicConstraints:[
        CA:true
        PathLen:2147483647
      ]
      
      #2: ObjectId: 2.5.29.15 Criticality=true
      KeyUsage [
        DigitalSignature
        Key_CertSign
        Crl_Sign
      ]
      
      #3: ObjectId: 2.5.29.14 Criticality=false
      SubjectKeyIdentifier [
      KeyIdentifier [
      0000: AB B6 DB D7 06 9E 37 AC   30 86 07 91 70 C7 9C C4  ......7.0...p...
      0010: 19 B1 78 C0                                        ..x.
      ]
      ]
      
      Trust this certificate? [no]:  yes
      Certificate was added to keystore
      Enter keystore password:  
      Owner: CN=Amazon Root CA 4, O=Amazon, C=US
      Issuer: CN=Amazon Root CA 4, O=Amazon, C=US
      Serial number: 66c9fd7c1bb104c2943e5717b7b2cc81ac10e
      Valid from: Tue May 26 00:00:00 UTC 2015 until: Sat May 26 00:00:00 UTC 2040
      Certificate fingerprints:
           SHA1: F6:10:84:07:D6:F8:BB:67:98:0C:C2:E2:44:C2:EB:AE:1C:EF:63:BE
           SHA256: E3:5D:28:41:9E:D0:20:25:CF:A6:90:38:CD:62:39:62:45:8D:A5:C6:95:FB:DE:A3:C2:2B:0B:FB:25:89:70:92
      Signature algorithm name: SHA384withECDSA
      Subject Public Key Algorithm: 384-bit EC (secp384r1) key
      Version: 3
      
      Extensions: 
      
      #1: ObjectId: 2.5.29.19 Criticality=true
      BasicConstraints:[
        CA:true
        PathLen:2147483647
      ]
      
      #2: ObjectId: 2.5.29.15 Criticality=true
      KeyUsage [
        DigitalSignature
        Key_CertSign
        Crl_Sign
      ]
      
      #3: ObjectId: 2.5.29.14 Criticality=false
      SubjectKeyIdentifier [
      KeyIdentifier [
      0000: D3 EC C7 3A 65 6E CC E1   DA 76 9A 56 FB 9C F3 86  ...:en...v.V....
      0010: 6D 57 E5 81                                        mW..
      ]
      ]
      
      Trust this certificate? [no]:  yes
      Certificate was added to keystore
      Enter keystore password:  
      Owner: OU=Starfield Class 2 Certification Authority, O="Starfield Technologies, Inc.", C=US
      Issuer: OU=Starfield Class 2 Certification Authority, O="Starfield Technologies, Inc.", C=US
      Serial number: 0
      Valid from: Tue Jun 29 17:39:16 UTC 2004 until: Thu Jun 29 17:39:16 UTC 2034
      Certificate fingerprints:
           SHA1: AD:7E:1C:28:B0:64:EF:8F:60:03:40:20:14:C3:D0:E3:37:0E:B5:8A
           SHA256: 14:65:FA:20:53:97:B8:76:FA:A6:F0:A9:95:8E:55:90:E4:0F:CC:7F:AA:4F:B7:C2:C8:67:75:21:FB:5F:B6:58
      Signature algorithm name: SHA1withRSA (weak)
      Subject Public Key Algorithm: 2048-bit RSA key
      Version: 3
      
      Extensions: 
      
      #1: ObjectId: 2.5.29.35 Criticality=false
      AuthorityKeyIdentifier [
      KeyIdentifier [
      0000: BF 5F B7 D1 CE DD 1F 86   F4 5B 55 AC DC D7 10 C2  ._.......[U.....
      0010: 0E A9 88 E7                                        ....
      ]
      [OU=Starfield Class 2 Certification Authority, O="Starfield Technologies, Inc.", C=US]
      SerialNumber: [    00]
      ]
      
      #2: ObjectId: 2.5.29.19 Criticality=false
      BasicConstraints:[
        CA:true
        PathLen:2147483647
      ]
      
      #3: ObjectId: 2.5.29.14 Criticality=false
      SubjectKeyIdentifier [
      KeyIdentifier [
      0000: BF 5F B7 D1 CE DD 1F 86   F4 5B 55 AC DC D7 10 C2  ._.......[U.....
      0010: 0E A9 88 E7                                        ....
      ]
      ]
      
      
      Warning:
      The input uses the SHA1withRSA signature algorithm which is considered a security risk. This algorithm will be disabled in a future update.
      
      Trust this certificate? [no]:  yes
      Certificate was added to keystore
      ```

1.  JVM 인수에 trustStore 파일을 첨부합니다.

   ```
   -Djavax.net.ssl.trustStore=path_to_file/cassandra_truststore.jks 
   -Djavax.net.ssl.trustStorePassword=my_password
   ```

## 서비스별 자격 증명을 사용하는 Apache Cassandra용 DataStax Java 드라이버를 사용하여 Amazon Keyspaces에 접속하는 단계별 튜토리얼
<a name="java_tutorial"></a>

다음 단계별 튜토리얼에서는 서비스별 자격 증명을 사용하는 Cassandra용 Java 드라이버를 사용하여 Amazon Keyspaces에 접속하는 방법을 소개합니다. 구체적으로는 Apache Cassandra용 DataStax Java 드라이버 4.0 버전을 사용합니다.

**Topics**
+ [

### 1단계: 사전 조건
](#java_tutorial.prereq)
+ [

### 2단계: 드라이버 구성
](#java_tutorial.driverconfiguration)
+ [

### 3단계: 샘플 애플리케이션 실행
](#java_tutorial.application)

### 1단계: 사전 조건
<a name="java_tutorial.prereq"></a>

이 튜토리얼에 따르려면 서비스별 자격 증명을 생성하고 Apache Cassandra용 DataStax Java 드라이버를 Java 프로젝트에 추가해야 합니다.
+ [Amazon Keyspaces에 프로그래밍 방식으로 액세스하기 위한 서비스별 자격 증명 만들기](programmatic.credentials.ssc.md)의 단계를 완료하여 Amazon Keyspaces IAM 사용자를 위한 서비스별 자격 증명을 생성합니다. IAM 액세스 키를 인증에 사용하려면 [Apache Cassandra용 4.x DataStax Java 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속하는 단계별 튜토리얼](#java_tutorial.SigV4)을 참조하세요.
+ Apache Cassandra용 DataStax Java 드라이버를 Java 프로젝트에 추가합니다. Apache Cassandra 3.11.2를 지원하는 드라이버 버전을 사용하고 있는지 확인하세요. 자세한 내용은 [Apache Cassandra용 DataStax Java 드라이버 설명서](https://github.com/datastax/java-driver)를 참조하세요.

### 2단계: 드라이버 구성
<a name="java_tutorial.driverconfiguration"></a>

애플리케이션용 구성 파일을 생성하여 DataStax Java Cassandra 드라이버에 대한 설정을 지정할 수 있습니다. 이 구성 파일은 기본 설정을 재정의하고 포트 9142를 사용하여 Amazon Keyspaces 서비스 엔드포인트에 접속하도록 드라이버에 지시합니다. 사용 가능한 서비스 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

구성 파일을 생성하고 애플리케이션의 리소스 폴더에 파일을 저장합니다(예: `src/main/resources/application.conf`). `application.conf`을 열고 다음 구성 설정을 열고 추가합니다.

1. **인증 제공자** - `PlainTextAuthProvider` 클래스를 사용하여 인증 제공자를 생성합니다. *ServiceUserName* 및 *ServicePassword*는 [Amazon Keyspaces에 프로그래밍 방식으로 액세스하기 위한 서비스별 자격 증명 만들기](programmatic.credentials.ssc.md)의 단계에 따라 서비스별 자격 증명을 생성할 때 얻은 사용자 이름 및 암호와 일치해야 합니다.
**참고**  
드라이버 구성 파일에 자격 증명을 하드코딩하는 대신 Apache Cassandra용 DataStax Java 드라이버를 위한 인증 플러그인을 통해 단기 자격 증명을 사용할 수 있습니다. 자세히 알아보려면 [Apache Cassandra용 4.x DataStax Java 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속하는 단계별 튜토리얼](#java_tutorial.SigV4)에 대한 안내를 따르세요.

1. **로컬 데이터 센터** - `local-datacenter`에 대한 값을 연결 대상 리전으로 설정합니다. 예를 들어 애플리케이션이 `cassandra.us-east-2.amazonaws.com`에 연결 중인 경우 로컬 데이터 센터를 `us-east-2`로 설정합니다. 사용 가능한 모든 AWS 리전에 대한 자세한 내용은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요. 더 적은 수의 노드에 대해 로드 밸런싱을 수행하도록 `slow-replica-avoidance = false`을 설정합니다.

1. **SSL/TLS** — `class = DefaultSslEngineFactory`를 통해 클래스를 지정하는 한 줄로 구성 파일에 섹션을 추가하여 SSLengineFactory를 초기화합니다. trustStore 파일의 경로와 이전에 만든 암호를 입력합니다. Amazon Keyspaces는 피어의 `hostname-validation`를 지원하지 않으므로 이 옵션을 false로 설정합니다.

```
datastax-java-driver {

    basic.contact-points = [ "cassandra.us-east-2.amazonaws.com:9142"]
    advanced.auth-provider{
        class = PlainTextAuthProvider
        username = "ServiceUserName"
        password = "ServicePassword"
    }
    basic.load-balancing-policy {
        local-datacenter = "us-east-2"
        slow-replica-avoidance = false           
    }

    advanced.ssl-engine-factory {
        class = DefaultSslEngineFactory
        truststore-path = "./src/main/resources/cassandra_truststore.jks"
        truststore-password = "my_password"
        hostname-validation = false
      }
}
```

**참고**  
구성 파일에 trustStore 경로를 추가하는 대신 애플리케이션 코드에 trustStore 경로를 직접 추가하거나 trustStore 경로를 JVM 인수에 추가할 수도 있습니다.

### 3단계: 샘플 애플리케이션 실행
<a name="java_tutorial.application"></a>

이 코드 예제는 앞서 만든 구성 파일을 사용하여 Amazon Keyspaces에 대한 연결 풀을 생성하는 간단한 명령줄 애플리케이션을 보여줍니다. 간단한 쿼리를 실행하여 연결이 설정되었는지 확인합니다.

```
package <your package>;
// add the following imports to your project
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.config.DriverConfigLoader;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;

public class App 
{
    
    public static void main( String[] args )
    {
        //Use DriverConfigLoader to load your configuration file
        DriverConfigLoader loader = DriverConfigLoader.fromClasspath("application.conf");
        try (CqlSession session = CqlSession.builder()
                .withConfigLoader(loader)
                .build()) {

            ResultSet rs = session.execute("select * from system_schema.keyspaces");
            Row row = rs.one();
            System.out.println(row.getString("keyspace_name"));
        }
    }
}
```

**참고**  
`try` 블록을 사용하여 연결이 항상 닫히도록 설정합니다. `try` 블록을 사용하지 않는 경우 리소스 유출을 방지하기 위해 연결을 닫아야 합니다.

## Apache Cassandra용 4.x DataStax Java 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속하는 단계별 튜토리얼
<a name="java_tutorial.SigV4"></a>

다음 섹션에서는 Apache Cassandra용 오픈 소스 4.x DataStax Java 드라이버를 위한 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces(Apache Cassandra용)에 액세스하는 방법을 설명합니다. 플러그인은 [GitHub 리포지토리](https://github.com/aws/aws-sigv4-auth-cassandra-java-driver-plugin)에서 다운로드할 수 있습니다.

SigV4 인증 플러그인을 사용하면 Amazon Keyspaces에 접속할 때 사용자 또는 역할에 대한 IAM 자격 증명을 사용할 수 있습니다. 이 플러그인은 사용자 이름과 비밀번호를 요구하는 대신 액세스 키를 사용하여 API 요청에 서명합니다. 자세한 내용은 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md) 단원을 참조하십시오.

### 1단계: 사전 조건
<a name="java_tutorial.SigV4.1"></a>

이 튜토리얼을 따르려면 다음 작업을 수행해야 합니다.
+ 아직 수행하지 않은 경우 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md)의 단계에 따라 IAM 사용자 또는 역할의 자격 증명을 생성합니다. 이 튜토리얼에서는 액세스 키가 환경 변수로 저장된다고 가정합니다. 자세한 내용은 [프로그래밍 방식 액세스를 위한 액세스 키 저장](aws.credentials.manage.md) 단원을 참조하십시오.
+ Apache Cassandra용 DataStax Java 드라이버를 Java 프로젝트에 추가합니다. Apache Cassandra 3.11.2를 지원하는 드라이버 버전을 사용하고 있는지 확인하세요. 자세한 내용은 [Apache Cassandra용 DataStax Java 드라이버 설명서](https://github.com/datastax/java-driver)를 참조하세요.
+ 애플리케이션에 인증 플러그인을 추가합니다. 인증 플러그인은 Apache Cassandra용 DataStax Java 드라이버 버전 4.x를 지원합니다. Apache Maven이나 Maven 종속성을 사용할 수 있는 빌드 시스템을 사용하는 경우 `pom.xml` 파일에 다음 종속성을 추가합니다.
**중요**  
[GitHub 리포지토리](https://github.com/aws/aws-sigv4-auth-cassandra-java-driver-plugin#add-the-authentication-plugin-to-the-application)에 표시된 대로 플러그인 버전을 최신 버전으로 교체합니다.

  ```
  <dependency>
          <groupId>software.aws.mcs</groupId>
          <artifactId>aws-sigv4-auth-cassandra-java-driver-plugin</artifactId>
          <version>4.0.9</version>
  </dependency>
  ```

### 2단계: 드라이버 구성
<a name="java_tutorial.SigV4.2"></a>

애플리케이션용 구성 파일을 생성하여 DataStax Java Cassandra 드라이버에 대한 설정을 지정할 수 있습니다. 이 구성 파일은 기본 설정을 재정의하고 포트 9142를 사용하여 Amazon Keyspaces 서비스 엔드포인트에 접속하도록 드라이버에 지시합니다. 사용 가능한 서비스 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

구성 파일을 생성하고 애플리케이션의 리소스 폴더에 파일을 저장합니다(예: `src/main/resources/application.conf`). `application.conf`을 열고 다음 구성 설정을 열고 추가합니다.

1. **인증 제공자** - `advanced.auth-provider.class`를 `software.aws.mcs.auth.SigV4AuthProvider`의 새 인스턴스로 설정합니다. SigV4AuthProvider는 SigV4 인증을 수행하기 위해 플러그인에서 제공하는 인증 핸들러입니다.

1. **로컬 데이터 센터** - `local-datacenter`에 대한 값을 연결 대상 리전으로 설정합니다. 예를 들어 애플리케이션이 `cassandra.us-east-2.amazonaws.com`에 연결 중인 경우 로컬 데이터 센터를 `us-east-2`로 설정합니다. 사용 가능한 모든 항목은 섹션을 AWS 리전참조하세요[Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md). 사용 가능한 모든 노드에 대해 로드 밸런싱으로 `slow-replica-avoidance = false`를 설정합니다.

1. **멱등성** - 실패한 읽기/쓰기/준비/실행 요청을 항상 다시 시도하도록 드라이버를 구성하려면 애플리케이션의 기본 `idempotence`를 `true`로 설정합니다. 이는 실패한 요청을 재시도하여 일시적인 실패를 처리하는 데 도움이 되는 분산 애플리케이션의 모범 사례입니다.

1. **SSL/TLS** — `class = DefaultSslEngineFactory`를 통해 클래스를 지정하는 한 줄로 구성 파일에 섹션을 추가하여 SSLengineFactory를 초기화합니다. trustStore 파일의 경로와 이전에 만든 암호를 입력합니다. Amazon Keyspaces는 피어의 `hostname-validation`를 지원하지 않으므로 이 옵션을 false로 설정합니다.

1. **연결** - `local.size = 3`을 설정하여 엔드포인트당 최소 3개의 로컬 연결을 생성합니다. 이는 애플리케이션이 오버헤드 및 트래픽 버스트를 처리하는 데 도움이 되는 모범 사례입니다. 예상 트래픽 패턴을 기반으로 애플리케이션에 필요한 엔드포인트당 로컬 연결 수를 계산하는 방법에 대한 자세한 내용은 [Amazon Keyspaces에서 연결을 구성하는 방법](connections.md#connections.howtoconfigure) 섹션을 참조하세요.

1. **재시도 정책** - Cassandra 드라이버와 함께 제공되는 `DefaultRetryPolicy` 대신 Amazon Keyspaces 재시도 정책 `AmazonKeyspacesExponentialRetryPolicy`를 구현합니다. 이를 통해 필요에 맞는 `AmazonKeyspacesExponentialRetryPolicy`의 재시도 시도 횟수를 구성할 수 있습니다. 기본적으로 `AmazonKeyspacesExponentialRetryPolicy`에 대한 재시도 횟수는 3으로 설정됩니다. 자세한 내용은 [Amazon Keyspaces에서 연결에 대한 재시도 정책을 구성하는 방법](connections.md#connections.retry-policies) 단원을 참조하십시오.

1. **준비된 문** - 네트워크 사용을 최적화하려면 `prepare-on-all-nodes`로 설정합니다.

```
datastax-java-driver {
    basic {
        contact-points = [ "cassandra.us-east-2.amazonaws.com:9142"]  
        request {
            timeout = 2 seconds
            consistency = LOCAL_QUORUM
            page-size = 1024
            default-idempotence = true
        }
        load-balancing-policy {
            local-datacenter = "us-east-2"
            class = DefaultLoadBalancingPolicy
            slow-replica-avoidance = false           
        }
    }
    advanced {
        auth-provider {
            class = software.aws.mcs.auth.SigV4AuthProvider
            aws-region = us-east-2
        }
        ssl-engine-factory {
            class = DefaultSslEngineFactory
            truststore-path = "./src/main/resources/cassandra_truststore.jks"
            truststore-password = "my_password"
            hostname-validation = false
        }
        connection {
	     connect-timeout = 5 seconds
	     max-requests-per-connection = 512
	     pool {
                local.size = 3
	     }
        }
       retry-policy {
           class =  com.aws.ssa.keyspaces.retry.AmazonKeyspacesExponentialRetryPolicy
	    max-attempts = 3
	    min-wait = 10 mills
	    max-wait = 100 mills
       }
       prepared-statements {
	    prepare-on-all-nodes = false
       }
    }
}
```

**참고**  
구성 파일에 trustStore 경로를 추가하는 대신 애플리케이션 코드에 trustStore 경로를 직접 추가하거나 trustStore 경로를 JVM 인수에 추가할 수도 있습니다.

### 3단계: 애플리케이션 실행
<a name="java_tutorial.SigV4.3"></a>

이 코드 예제는 앞서 만든 구성 파일을 사용하여 Amazon Keyspaces에 대한 연결 풀을 생성하는 간단한 명령줄 애플리케이션을 보여줍니다. 간단한 쿼리를 실행하여 연결이 설정되었는지 확인합니다.

```
package <your package>;
// add the following imports to your project
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.config.DriverConfigLoader;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;

public class App 
{
    
    public static void main( String[] args )
    {
        //Use DriverConfigLoader to load your configuration file
        DriverConfigLoader loader = DriverConfigLoader.fromClasspath("application.conf");
        try (CqlSession session = CqlSession.builder()
                .withConfigLoader(loader)
                .build()) {

            ResultSet rs = session.execute("select * from system_schema.keyspaces");
            Row row = rs.one();
            System.out.println(row.getString("keyspace_name"));
        }
    }
}
```

**참고**  
`try` 블록을 사용하여 연결이 항상 닫히도록 설정합니다. `try` 블록을 사용하지 않는 경우 리소스 유출을 방지하기 위해 연결을 닫아야 합니다.

## Apache Cassandra용 4.x DataStax Java 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속
<a name="java3x_tutorial.SigV4"></a>

다음 섹션에서는 Apache Cassandra용 3.x 오픈 소스 DataStax Java 드라이버를 위한 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 액세스하는 방법을 설명합니다. 플러그인은 [GitHub 리포지토리](https://github.com/aws/aws-sigv4-auth-cassandra-java-driver-plugin/tree/3.x-Driver-Compatible)에서 다운로드할 수 있습니다.

SigV4 인증 플러그인을 사용하면 Amazon Keyspaces에 접속할 때 사용자 및 역할에 대한 IAM 자격 증명을 사용할 수 있습니다. 이 플러그인은 사용자 이름과 비밀번호를 요구하는 대신 액세스 키를 사용하여 API 요청에 서명합니다. 자세한 내용은 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md) 단원을 참조하십시오.

### 1단계: 사전 조건
<a name="java3x_tutorial.SigV4.1"></a>

이 코드 샘플을 실행하려면 먼저 다음 작업을 수행해야 합니다.
+ [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md)의 단계에 따라 IAM 사용자 또는 역할의 자격 증명을 생성합니다. 이 튜토리얼에서는 액세스 키가 환경 변수로 저장된다고 가정합니다. 자세한 내용은 [프로그래밍 방식 액세스를 위한 액세스 키 저장](aws.credentials.manage.md) 단원을 참조하십시오.
+ 의 단계에 따라 디지털 인증서를 다운로드[시작하기 전 준비 사항](#using_java_driver.BeforeYouBegin)하고, 이를 trustStore 파일로 변환하고, JVM 인수의 키 스토어를 애플리케이션에 연결합니다.
+ Apache Cassandra용 DataStax Java 드라이버를 Java 프로젝트에 추가합니다. Apache Cassandra 3.11.2를 지원하는 드라이버 버전을 사용하고 있는지 확인하세요. 자세한 내용은 [Apache Cassandra용 DataStax Java 드라이버 설명서](https://github.com/datastax/java-driver)를 참조하세요.
+ 애플리케이션에 인증 플러그인을 추가합니다. 인증 플러그인은 Apache Cassandra용 DataStax Java 드라이버 버전 3.x를 지원합니다. Apache Maven이나 Maven 종속성을 사용할 수 있는 빌드 시스템을 사용하는 경우 `pom.xml` 파일에 다음 종속성을 추가합니다. [GitHub 리포지토리](https://github.com/aws/aws-sigv4-auth-cassandra-java-driver-plugin/tree/3.x-Driver-Compatible)에 표시된 대로 플러그인 버전을 최신 버전으로 교체합니다.

  ```
  <dependency>
          <groupId>software.aws.mcs</groupId>
          <artifactId>aws-sigv4-auth-cassandra-java-driver-plugin_3</artifactId>
          <version>3.0.3</version>
  </dependency>
  ```

### 2단계: 애플리케이션 실행
<a name="java3x_tutorial.SigV4.3"></a>

이 코드 예제는 Amazon Keyspaces에 대한 연결 풀을 생성하는 간단한 명령줄 애플리케이션을 보여줍니다. 간단한 쿼리를 실행하여 연결이 설정되었는지 확인합니다.

```
package <your package>;
// add the following imports to your project

import software.aws.mcs.auth.SigV4AuthProvider;  
import com.datastax.driver.core.Cluster;  
import com.datastax.driver.core.ResultSet;  
import com.datastax.driver.core.Row;  
import com.datastax.driver.core.Session;

public class App 
{
    
    public static void main( String[] args )
    {
        String endPoint = "cassandra.us-east-2.amazonaws.com";  
        int portNumber = 9142;
        Session session = Cluster.builder()  
	                                 .addContactPoint(endPoint)  
	                                 .withPort(portNumber)  
	                                 .withAuthProvider(new SigV4AuthProvider("us-east-2"))  
	                                 .withSSL()  
	                                 .build()  
	                                 .connect();

        ResultSet rs = session.execute("select * from system_schema.keyspaces");  
        Row row = rs.one();  
        System.out.println(row.getString("keyspace_name"));
    }
}
```

사용 노트:

사용 가능한 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

Amazon Keyspace와 함께 Java Driver를 사용할 때 유용한 Java 드라이버 정책, 예제, 모범 사례는 [https://github.com/aws-samples/amazon-keyspaces-java-driver-helpers](https://github.com/aws-samples/amazon-keyspaces-java-driver-helpers) 리포지토리를 참조하십시오.

# Cassandra Python 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
<a name="using_python_driver"></a>

 이 섹션에서는 Python 클라이언트 드라이버를 사용하여 Amazon Keyspaces에 접속하는 방법을 소개합니다. Amazon Keyspaces 리소스에 프로그래밍 방식으로 액세스할 수 있는 자격 증명을 사용자와 애플리케이션에 제공하려면 다음 중 하나를 수행할 수 있습니다.
+ 특정 AWS Identity and Access Management (IAM) 사용자와 연결된 서비스별 자격 증명을 생성합니다.
+ 보안을 강화하려면 모든 AWS 서비스에서 사용되는 IAM 사용자 또는 역할에 대한 IAM 액세스 키를 생성하는 것이 좋습니다. Cassandra 클라이언트 드라이버용 Amazon Keyspaces SigV4 인증 플러그인을 사용하면 사용자 이름 및 암호 대신 IAM 액세스 키를 사용하여 Amazon Keyspaces에 대한 호출을 인증할 수 있습니다. 자세한 내용은 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md) 단원을 참조하십시오.

**Topics**
+ [

## 시작하기 전 준비 사항
](#using_python_driver.BeforeYouBegin)
+ [

## Apache Cassandra용 Python 드라이버와 서비스별 자격 증명을 사용하여 Amazon Keyspaces에 접속합니다.
](#python_ssc)
+ [

## Apache Cassandra용 DataStax Python 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속
](#python_SigV4)

## 시작하기 전 준비 사항
<a name="using_python_driver.BeforeYouBegin"></a>

시작하기 전에 다음 작업을 수행해야 합니다.

Amazon Keyspaces에서는 클라이언트와의 연결을 보호하는 데 도움이 되는 전송 계층 보안(TLS)을 사용해야 합니다. TLS를 사용하여 Amazon Keyspaces에 연결하려면 Amazon 디지털 인증서를 다운로드하고 TLS를 사용하도록 Python 드라이버를 구성해야 합니다.

 다음 디지털 인증서를 다운로드하고 파일을 로컬 또는 홈 디렉터리에 저장합니다.

1. AmazonRootCA1

1. AmazonRootCA2

1. AmazonRootCA3

1. AmazonRootCA4

1. Starfield 클래스 2 루트(선택 사항 - 이전 버전과의 호환성을 위해)

인증서를 다운로드하려면 다음 명령을 사용할 수 있습니다.

```
curl -O https://www.amazontrust.com/repository/AmazonRootCA1.pem
curl -O https://www.amazontrust.com/repository/AmazonRootCA2.pem
curl -O https://www.amazontrust.com/repository/AmazonRootCA3.pem
curl -O https://www.amazontrust.com/repository/AmazonRootCA4.pem
curl -O https://certs.secureserver.net/repository/sf-class2-root.crt
```

**참고**  
Amazon Keyspaces는 이전에 Starfield Class 2 CA에 고정된 TLS 인증서를 사용했습니다. AWS 는 Amazon Trust Services(Amazon Root CA 1\$14)에 따라 발급된 인증서 AWS 리전 로 모두 마이그레이션하고 있습니다. CAs 이 전환 중에 Amazon Root CAs1\$14와 Starfield 루트를 모두 신뢰하도록 클라이언트를 구성하여 모든 리전에서 호환성을 보장합니다.

예제에서 다운로드한 모든 인증서를 *keyspaces-bundle.pem*이라는 이름과 함께 단일 `pem` 파일로 결합합니다. 다음 명령을 실행하여 이 작업을 수행할 수 있습니다. 파일의 경로를 기록해 둡니다. 나중에 필요합니다.

```
cat AmazonRootCA1.pem \
 AmazonRootCA2.pem \
 AmazonRootCA3.pem \
 AmazonRootCA4.pem \
 sf-class2-root.crt \
 > keyspaces-bundle.pem
```

## Apache Cassandra용 Python 드라이버와 서비스별 자격 증명을 사용하여 Amazon Keyspaces에 접속합니다.
<a name="python_ssc"></a>

다음 코드 예제는 Python 클라이언트 드라이버 및 서비스별 자격 증명을 사용하여 Amazon Keyspaces에 접속하는 방법을 보여줍니다.

```
from cassandra.cluster import Cluster
from ssl import SSLContext, PROTOCOL_TLSv1_2 , CERT_REQUIRED
from cassandra.auth import PlainTextAuthProvider

ssl_context = SSLContext(PROTOCOL_TLSv1_2 )

ssl_context.load_verify_locations('path_to_file/keyspaces-bundle.pem')

ssl_context.verify_mode = CERT_REQUIRED
auth_provider = PlainTextAuthProvider(username='ServiceUserName', password='ServicePassword')
cluster = Cluster(['cassandra.us-east-2.amazonaws.com'], ssl_context=ssl_context, auth_provider=auth_provider, port=9142)
session = cluster.connect()
r = session.execute('select * from system_schema.keyspaces')
print(r.current_rows)
```

사용 노트:

1. 를 첫 번째 단계에서 저장된 결합된 인증서 파일의 경로`"path_to_file/keyspaces-bundle.pem"`로 바꿉니다.

1. *ServiceUserName*과 *ServicePassword*는 [Amazon Keyspaces에 프로그래밍 방식으로 액세스하기 위한 서비스별 자격 증명 만들기](programmatic.credentials.ssc.md)에 대한 단계에 따라 서비스별 자격 증명을 생성할 때 얻은 사용자 이름 및 암호와 일치해야 합니다.

1. 사용 가능한 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

## Apache Cassandra용 DataStax Python 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속
<a name="python_SigV4"></a>

다음 섹션에서는 Apache Cassandra용 오픈 소스 DataStax Python 드라이버를 위한 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces(Apache Cassandra용) 에 액세스하는 방법을 설명합니다.

아직 수행하지 않은 경우 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md)의 단계에 따라 IAM 역할의 자격 증명을 생성합니다. 이 튜토리얼에서는 IAM 역할이 필요한 임시 자격 증명을 사용합니다. 임시 자격 증명에 대한 자세한 내용은 [IAM 역할 및 SigV4 플러그인을 생성하여 임시 자격 증명으로 Amazon Keyspaces에 접속](temporary.credentials.IAM.md) 섹션을 참조하세요.

그런 다음 [GitHub 리포지토리](https://github.com/aws/aws-sigv4-auth-cassandra-python-driver-plugin)에서 Python SigV4 인증 플러그인을 환경에 추가합니다.

```
pip install cassandra-sigv4
```

다음 코드 예제는 Cassandra용 오픈 소스 DataStax Python 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속하는 방법을 보여줍니다. 플러그인은 AWS SDK for Python(Boto3)에 따라 달라집니다. `boto3.session`을 통해 임시 자격 증명이 생성됩니다.

```
from cassandra.cluster import Cluster
from ssl import SSLContext, PROTOCOL_TLSv1_2 , CERT_REQUIRED
from cassandra.auth import PlainTextAuthProvider
import boto3
from cassandra_sigv4.auth import SigV4AuthProvider

ssl_context = SSLContext(PROTOCOL_TLSv1_2)
ssl_context.load_verify_locations('path_to_file/keyspaces-bundle.pem')
ssl_context.verify_mode = CERT_REQUIRED

# use this if you want to use Boto to set the session parameters.
boto_session = boto3.Session(aws_access_key_id="AKIAIOSFODNN7EXAMPLE",
                             aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
                             aws_session_token="AQoDYXdzEJr...<remainder of token>",
                             region_name="us-east-2")
auth_provider = SigV4AuthProvider(boto_session)

# Use this instead of the above line if you want to use the Default Credentials and not bother with a session.
# auth_provider = SigV4AuthProvider()

cluster = Cluster(['cassandra.us-east-2.amazonaws.com'], ssl_context=ssl_context, auth_provider=auth_provider,
                  port=9142)
session = cluster.connect()
r = session.execute('select * from system_schema.keyspaces')
print(r.current_rows)
```

사용 노트:

1. `"path_to_file/keyspaces-bundle.pem"`을 첫 번째 단계에서 저장한 인증서 경로로 바꿉니다.

1. *aws\$1access\$1key\$1id*, *aws\$1secret\$1access\$1key*, *aws\$1session\$1token*이 `boto3.session`를 사용하여 얻은 `Access Key`, `Secret Access Key`, `Session Token`와 일치하는지 확인합니다. 자세한 내용은 *AWS SDK for Python (Boto3)*의 [자격 증명](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html)을 참조하세요.

1. 사용 가능한 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

# Cassandra Node.js 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
<a name="using_nodejs_driver"></a>

 이 섹션에서는 Node.js 클라이언트 드라이버를 사용하여 Amazon Keyspaces에 접속하는 방법을 소개합니다. Amazon Keyspaces 리소스에 프로그래밍 방식으로 액세스할 수 있는 자격 증명을 사용자와 애플리케이션에 제공하려면 다음 중 하나를 수행할 수 있습니다.
+ 특정 AWS Identity and Access Management (IAM) 사용자와 연결된 서비스별 자격 증명을 생성합니다.
+ 보안을 강화하려면 모든 AWS 서비스에서 사용되는 IAM 사용자 또는 역할에 대한 IAM 액세스 키를 생성하는 것이 좋습니다. Cassandra 클라이언트 드라이버용 Amazon Keyspaces SigV4 인증 플러그인을 사용하면 사용자 이름 및 암호 대신 IAM 액세스 키를 사용하여 Amazon Keyspaces에 대한 호출을 인증할 수 있습니다. 자세한 내용은 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md) 단원을 참조하십시오.

**Topics**
+ [

## 시작하기 전 준비 사항
](#using_nodejs_driver.BeforeYouBegin)
+ [

## Apache Cassandra용 Node.js DataStax 드라이버와 서비스별 자격 증명을 사용하여 Amazon Keyspaces에 접속합니다.
](#nodejs_ssc)
+ [

## Apache Cassandra용 DataStax Node.js 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속
](#nodejs_SigV4)

## 시작하기 전 준비 사항
<a name="using_nodejs_driver.BeforeYouBegin"></a>

시작하기 전에 다음 작업을 수행해야 합니다.

Amazon Keyspaces에서는 클라이언트와의 연결을 보호하는 데 도움이 되는 전송 계층 보안(TLS)을 사용해야 합니다. TLS를 사용하여 Amazon Keyspace에 접속하려면 Amazon 디지털 인증서를 다운로드하고 TLS를 사용하도록 Python 드라이버를 구성해야 합니다.

 다음 디지털 인증서를 다운로드하고 파일을 로컬 또는 홈 디렉터리에 저장합니다.

1. AmazonRootCA1

1. AmazonRootCA2

1. AmazonRootCA3

1. AmazonRootCA4

1. Starfield 클래스 2 루트(선택 사항 - 이전 버전과의 호환성을 위해)

인증서를 다운로드하려면 다음 명령을 사용할 수 있습니다.

```
curl -O https://www.amazontrust.com/repository/AmazonRootCA1.pem
curl -O https://www.amazontrust.com/repository/AmazonRootCA2.pem
curl -O https://www.amazontrust.com/repository/AmazonRootCA3.pem
curl -O https://www.amazontrust.com/repository/AmazonRootCA4.pem
curl -O https://certs.secureserver.net/repository/sf-class2-root.crt
```

**참고**  
Amazon Keyspaces는 이전에 Starfield Class 2 CA에 고정된 TLS 인증서를 사용했습니다. AWS 는 Amazon Trust Services(Amazon Root CA 1\$14)에 따라 발급된 인증서 AWS 리전 로 모두 마이그레이션하고 있습니다. CAs 이 전환 중에 Amazon Root CAs1\$14와 Starfield 루트를 모두 신뢰하도록 클라이언트를 구성하여 모든 리전에서 호환성을 보장합니다.

예제에서 다운로드한 모든 인증서를 *keyspaces-bundle.pem*이라는 이름과 함께 단일 `pem` 파일로 결합합니다. 다음 명령을 실행하여 이 작업을 수행할 수 있습니다. 파일의 경로를 기록해 둡니다. 나중에 필요합니다.

```
cat AmazonRootCA1.pem \
 AmazonRootCA2.pem \
 AmazonRootCA3.pem \
 AmazonRootCA4.pem \
 sf-class2-root.crt \
 > keyspaces-bundle.pem
```

## Apache Cassandra용 Node.js DataStax 드라이버와 서비스별 자격 증명을 사용하여 Amazon Keyspaces에 접속합니다.
<a name="nodejs_ssc"></a>

 TLS에 결합된 인증서 파일을 사용하고 서비스별 자격 증명을 사용하여 인증하도록 드라이버`keyspaces-bundle.pem`를 구성합니다. 예제: 

```
const cassandra = require('cassandra-driver');
const fs = require('fs');
const auth = new cassandra.auth.PlainTextAuthProvider('ServiceUserName', 'ServicePassword');
const sslOptions1 = {
         ca: [
                    fs.readFileSync('path_to_file/keyspaces-bundle.pem', 'utf-8')],      
                    host: 'cassandra.us-west-2.amazonaws.com',
                    rejectUnauthorized: true
        };
const client = new cassandra.Client({
                   contactPoints: ['cassandra.us-west-2.amazonaws.com'],
                   localDataCenter: 'us-west-2',
                   authProvider: auth,
                   sslOptions: sslOptions1,
                   protocolOptions: { port: 9142 }
        });
const query = 'SELECT * FROM system_schema.keyspaces';
 
client.execute(query)
                    .then( result => console.log('Row from Keyspaces %s', result.rows[0]))
                    .catch( e=> console.log(`${e}`));
```

사용 노트:

1. 를 첫 번째 단계에서 저장된 결합된 인증서 파일의 경로`"path_to_file/keyspaces-bundle.pem"`로 바꿉니다.

1. *ServiceUserName*과 *ServicePassword*는 [Amazon Keyspaces에 프로그래밍 방식으로 액세스하기 위한 서비스별 자격 증명 만들기](programmatic.credentials.ssc.md)에 대한 단계에 따라 서비스별 자격 증명을 생성할 때 얻은 사용자 이름 및 암호와 일치해야 합니다.

1. 사용 가능한 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

## Apache Cassandra용 DataStax Node.js 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속
<a name="nodejs_SigV4"></a>

다음 섹션에서는 Apache Cassandra용 오픈 소스 DataStax Node.js 드라이버를 위한 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces(Apache Cassandra용) 에 액세스하는 방법을 설명합니다.

아직 수행하지 않은 경우 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md)의 단계에 따라 IAM 사용자 또는 역할의 자격 증명을 생성합니다.

[GitHub 리포지토리](https://github.com/aws/aws-sigv4-auth-cassandra-nodejs-driver-plugin)에서 Node.js SigV4 인증 플러그인을 애플리케이션에 추가합니다. 플러그인은 Cassandra용 DataStax Node.js 드라이버 버전 4.x를 지원하며 Node.js용 AWS SDK에 따라 다릅니다. `AWSCredentialsProvider`을 통해 자격 증명이 생성됩니다.

```
$ npm install aws-sigv4-auth-cassandra-plugin --save
```

이 코드 예제는 `SigV4AuthProvider`의 리전별 인스턴스를 인증 공급자로 설정하는 방법을 보여줍니다.

```
const cassandra = require('cassandra-driver');
const fs = require('fs');
const sigV4 = require('aws-sigv4-auth-cassandra-plugin');

const auth = new sigV4.SigV4AuthProvider({
    region: 'us-west-2', 
    accessKeyId:'AKIAIOSFODNN7EXAMPLE',
    secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'});

const sslOptions1 = {
  ca: [
      fs.readFileSync('path_to_file/keyspaces-bundle.pem', 'utf-8')],
  host: 'cassandra.us-west-2.amazonaws.com',
  rejectUnauthorized: true
};


const client = new cassandra.Client({
  contactPoints: ['cassandra.us-west-2.amazonaws.com'],
  localDataCenter: 'us-west-2',
  authProvider: auth,
  sslOptions: sslOptions1,
  protocolOptions: { port: 9142 }
});


const query = 'SELECT * FROM system_schema.keyspaces';

client.execute(query).then(
    result => console.log('Row from Keyspaces %s', result.rows[0]))
    .catch( e=> console.log(`${e}`));
```

사용 노트:

1. `"path_to_file/keyspaces-bundle.pem"`을 첫 번째 단계에서 저장한 인증서 경로로 바꿉니다.

1. *accessKeyID*와 *secretAccessKey*가 `AWSCredentialsProvider`을 사용하여 획득한 액세스 키 및 비밀 액세스 키와 일치하는지 확인합니다. 자세한 내용은 *Node.js의 JavaScript용AWS SDK*의 [Node.js의 자격 증명 설정](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html)을 참조하세요.

1. 액세스 키를 코드 외부에 저장하는 경우의 모범 사례는 [프로그래밍 방식 액세스를 위한 액세스 키 저장](aws.credentials.manage.md) 섹션을 참조하세요.

1. 사용 가능한 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

# Cassandra. NET Core 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
<a name="using_dotnetcore_driver"></a>

이 섹션에서는 .NET Core 클라이언트 드라이버를 사용하여 Amazon Keyspaces에 접속하는 방법을 소개합니다. 설정 단계는 환경 및 운영 체제에 따라 다르므로 그에 따라 수정해야 할 수도 있습니다. Amazon Keyspaces에서는 클라이언트와의 연결을 보호하는 데 도움이 되는 전송 계층 보안(TLS)을 사용해야 합니다. TLS를 사용하여 Amazon Keyspaces에 연결하려면 Amazon Root CAs 1-4가 포함된 시스템 트러스트 스토어를 사용하도록 드라이버를 구성합니다.

1.  너겟 콘솔을 사용하여 너겟을 통해 CassandraCSharpDriver를 설치합니다.

   ```
   PM> Install-Package CassandraCSharpDriver
   ```

1. 다음 예제는.NET Core C\$1 콘솔 프로젝트를 사용하여 Amazon Keyspaces에 접속하고 쿼리를 실행합니다.

   ```
   using Cassandra;
   using System;
   using System.Collections.Generic;
   using System.Linq;
   using System.Net.Security;
   using System.Runtime.ConstrainedExecution;
   using System.Security.Cryptography.X509Certificates;
   using System.Text;
   using System.Threading.Tasks;
   
   namespace CSharpKeyspacesExample
   {
       class Program
       {
           public Program(){}
   
           static void Main(string[] args)
           {
               var userName = "ServiceUserName";
               var pwd = "ServicePassword";
               certCollection.Add(amazoncert);
    
               var awsEndpoint =  "cassandra.us-east-2.amazonaws.com" ;  
   
               var cluster = Cluster.Builder()
                        .AddContactPoints(awsEndpoint)
                        .WithPort(9142)
                        .WithAuthProvider(new PlainTextAuthProvider(userName, pwd))
                        .WithSSL(new SSLOptions().SetCertificateCollection(certCollection))
                        .Build();
   
               var session = cluster.Connect();
               var rs = session.Execute("SELECT * FROM system_schema.tables;");
               foreach (var row in rs)
               {
                   var name = row.GetValue<String>("keyspace_name");
                   Console.WriteLine(name);
               }
           }
       }
   }
   ```

사용 노트:

1. Amazon Root CAs 트러스트 스토어를 사용해야 합니다.

1. *ServiceUserName*과 *ServicePassword*는 [Amazon Keyspaces에 프로그래밍 방식으로 액세스하기 위한 서비스별 자격 증명 만들기](programmatic.credentials.ssc.md)에 대한 단계에 따라 서비스별 자격 증명을 생성할 때 얻은 사용자 이름 및 암호와 일치해야 합니다.

1. 사용 가능한 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

# Cassandra Go 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
<a name="using_go_driver"></a>

이 섹션에서는 Go Cassandra 클라이언트 드라이버를 사용하여 Amazon Keyspaces에 접속하는 방법을 소개합니다. Amazon Keyspaces 리소스에 프로그래밍 방식으로 액세스할 수 있는 자격 증명을 사용자와 애플리케이션에 제공하려면 다음 중 하나를 수행할 수 있습니다.
+ 특정 AWS Identity and Access Management (IAM) 사용자와 연결된 서비스별 자격 증명을 생성합니다.
+ 보안을 강화하려면 모든 AWS 서비스에서 사용되는 IAM 보안 주체에 대한 IAM 액세스 키를 생성하는 것이 좋습니다. Cassandra 클라이언트 드라이버용 Amazon Keyspaces SigV4 인증 플러그인을 사용하면 사용자 이름 및 암호 대신 IAM 액세스 키를 사용하여 Amazon Keyspaces에 대한 호출을 인증할 수 있습니다. 자세한 내용은 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md) 단원을 참조하십시오.

**Topics**
+ [

## 시작하기 전 준비 사항
](#using_go_driver.BeforeYouBegin)
+ [

## Apache Cassandra용 Gocql 드라이버와 서비스별 자격 증명을 사용하여 Amazon Keyspaces에 접속합니다.
](#go_ssc)
+ [

## Apache Cassandra용 Go 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속
](#go_SigV4)

## 시작하기 전 준비 사항
<a name="using_go_driver.BeforeYouBegin"></a>

시작하기 전에 다음 작업을 수행해야 합니다.

Amazon Keyspaces에서는 클라이언트와의 연결을 보호하는 데 도움이 되는 전송 계층 보안(TLS)을 사용해야 합니다. TLS를 사용하여 Amazon Keyspace에 접속하려면 Amazon 디지털 인증서를 다운로드하고 TLS를 사용하도록 Go 드라이버를 구성해야 합니다.

 다음 디지털 인증서를 다운로드하고 파일을 로컬 또는 홈 디렉터리에 저장합니다.

1. AmazonRootCA1

1. AmazonRootCA2

1. AmazonRootCA3

1. AmazonRootCA4

1. Starfield 클래스 2 루트(선택 사항 - 이전 버전과의 호환성을 위해)

인증서를 다운로드하려면 다음 명령을 사용할 수 있습니다.

```
curl -O https://www.amazontrust.com/repository/AmazonRootCA1.pem
curl -O https://www.amazontrust.com/repository/AmazonRootCA2.pem
curl -O https://www.amazontrust.com/repository/AmazonRootCA3.pem
curl -O https://www.amazontrust.com/repository/AmazonRootCA4.pem
curl -O https://certs.secureserver.net/repository/sf-class2-root.crt
```

**참고**  
Amazon Keyspaces는 이전에 Starfield Class 2 CA에 고정된 TLS 인증서를 사용했습니다. AWS 는 Amazon Trust Services(Amazon Root CA 1\$14)에 따라 발급된 인증서 AWS 리전 로 모두 마이그레이션하고 있습니다. CAs 이 전환 중에 Amazon Root CAs1\$14와 Starfield 루트를 모두 신뢰하도록 클라이언트를 구성하여 모든 리전에서 호환성을 보장합니다.

예제에서 다운로드한 모든 인증서를 *keyspaces-bundle.pem*이라는 이름과 함께 단일 `pem` 파일로 결합합니다. 다음 명령을 실행하여 이 작업을 수행할 수 있습니다. 파일의 경로를 기록해 둡니다. 나중에 필요합니다.

```
cat AmazonRootCA1.pem \
 AmazonRootCA2.pem \
 AmazonRootCA3.pem \
 AmazonRootCA4.pem \
 sf-class2-root.crt \
 > keyspaces-bundle.pem
```

## Apache Cassandra용 Gocql 드라이버와 서비스별 자격 증명을 사용하여 Amazon Keyspaces에 접속합니다.
<a name="go_ssc"></a>

1. 애플리케이션용 디렉터리를 생성합니다.

   ```
   mkdir ./gocqlexample
   ```

1. 새 디렉터리로 이동합니다.

   ```
   cd gocqlexample
   ```

1. 애플리케이션에 대한 파일을 생성합니다.

   ```
   touch cqlapp.go
   ```

1. Go 드라이버를 다운로드합니다.

   ```
   go get github.com/gocql/gocql
   ```

1. 다음 샘플 코드를 cqlapp.go 파일에 추가합니다.

   ```
   package main
   
   import (
   	    "fmt"
   	    "github.com/gocql/gocql"
   	    "log"
   )
   
   func main() {
   
       // add the Amazon Keyspaces service endpoint 
       cluster := gocql.NewCluster("cassandra.us-east-2.amazonaws.com")
       cluster.Port=9142
       // add your service specific credentials
       cluster.Authenticator = gocql.PasswordAuthenticator{
               Username: "ServiceUserName",
               Password: "ServicePassword"}
   
       // provide the path to the keyspaces-bundle.pem
       cluster.SslOpts = &gocql.SslOptions{
               CaPath: "path_to_file/keyspaces-bundle.pem",
               EnableHostVerification: false,            
        }
   
        // Override default Consistency to LocalQuorum
        cluster.Consistency = gocql.LocalQuorum
        cluster.DisableInitialHostLookup = false
   
        session, err := cluster.CreateSession()
        if err != nil {
               fmt.Println("err>", err)
        }
        defer session.Close()
   
        // run a sample query from the system keyspace
        var text string
        iter := session.Query("SELECT keyspace_name FROM system_schema.tables;").Iter()
        for iter.Scan(&text) {
               fmt.Println("keyspace_name:", text)
        }
        if err := iter.Close(); err != nil {
               log.Fatal(err)
        }
        session.Close()
   }
   ```

   사용 노트:

   1. 를 첫 번째 단계에서 저장된 결합된 인증서 파일의 경로`"path_to_file/keyspaces-bundle.pem"`로 바꿉니다.

   1. *ServiceUserName*과 *ServicePassword*는 [Amazon Keyspaces에 프로그래밍 방식으로 액세스하기 위한 서비스별 자격 증명 만들기](programmatic.credentials.ssc.md)에 대한 단계에 따라 서비스별 자격 증명을 생성할 때 얻은 사용자 이름 및 암호와 일치해야 합니다.

   1. 사용 가능한 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

1. 프로그램을 빌드합니다.

   ```
   go build cqlapp.go
   ```

1. 프로그램을 실행합니다.

   ```
   ./cqlapp
   ```

## Apache Cassandra용 Go 드라이버와 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces에 접속
<a name="go_SigV4"></a>

다음 코드 샘플에서는 오픈 소스 Go 드라이버를 위한 SigV4 인증 플러그인을 사용하여 Amazon Keyspaces(Apache Cassandra용) 에 액세스하는 방법을 설명합니다.

아직 수행하지 않은 경우 [Amazon Keyspaces에 대한 AWS 자격 증명 생성 및 구성](access.credentials.md)의 단계에 따라 IAM 위탁자의 자격 증명을 생성합니다. 애플리케이션이 Lambda 또는 Amazon EC2 인스턴스에서 실행 중인 경우 애플리케이션은 인스턴스의 자격 증명을 자동으로 사용합니다. 이 자습서를 로컬에서 실행하려면 자격 증명을 로컬 환경 변수로 저장할 수 있습니다.

[GitHub 리포지토리](https://github.com/aws/aws-sigv4-auth-cassandra-gocql-driver-plugin)에서 Go SigV4 인증 플러그인을 애플리케이션에 추가합니다. 플러그인은 Cassandra용 오픈 소스 Go 드라이버 버전 1.2.x를 지원하며 AWS SDK for Go에 따라 다릅니다.

```
$ go mod init
$ go get github.com/aws/aws-sigv4-auth-cassandra-gocql-driver-plugin
```

이 코드 예제에서 Amazon Keyspaces 엔드포인트는 `Cluster` 클래스로 표현됩니다. 클러스터의 인증 속성에 대한 `AwsAuthenticator`을 통해 자격 증명이 생성됩니다.

```
package main

import (
        "fmt"
        "github.com/aws/aws-sigv4-auth-cassandra-gocql-driver-plugin/sigv4"
        "github.com/gocql/gocql"
        "log"
)

func main() {
    // configuring the cluster options
    cluster := gocql.NewCluster("cassandra.us-west-2.amazonaws.com")
    cluster.Port=9142
    
    // the authenticator uses the default credential chain to find AWS credentials
    cluster.Authenticator = sigv4.NewAwsAuthenticator()

    cluster.SslOpts = &gocql.SslOptions{

            CaPath: "path_to_file/keyspaces-bundle.pem",
            EnableHostVerification: false,
    }
    cluster.Consistency = gocql.LocalQuorum
    cluster.DisableInitialHostLookup = false
   
    session, err := cluster.CreateSession()
    if err != nil {
	    fmt.Println("err>", err)
	    return
    }
    defer session.Close()

    // doing the query
    var text string
    iter := session.Query("SELECT keyspace_name FROM system_schema.tables;").Iter()
    for iter.Scan(&text) {
	    fmt.Println("keyspace_name:", text)
    }
    if err := iter.Close(); err != nil {
	    log.Fatal(err)
    }
}
```

사용 노트:

1. 를 첫 번째 단계에서 저장된 인증서 파일의 경로`"path_to_file/keyspaces-bundle.pem"`로 바꿉니다.

1. 이 예제를 로컬에서 실행하려면 다음 변수를 환경 변수로 정의해야 합니다.
   + `AWS_ACCESS_KEY_ID`
   + `AWS_SECRET_ACCESS_KEY`
   + `AWS_DEFAULT_REGION`

1. 액세스 키를 코드 외부에 저장하는 경우의 모범 사례는 [프로그래밍 방식 액세스를 위한 액세스 키 저장](aws.credentials.manage.md) 섹션을 참조하세요.

1. 사용 가능한 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

# Cassandra Perl 클라이언트 드라이버를 사용하여 프로그래밍 방식으로 Amazon Keyspaces에 액세스
<a name="using_perl_driver"></a>

이 섹션에서는 Perl 클라이언트 드라이버를 사용하여 Amazon Keyspaces에 접속하는 방법을 소개합니다. 이 코드 샘플에서는 Perl 5를 사용했습니다. Amazon Keyspaces에서는 클라이언트와의 연결을 보호하는 데 도움이 되는 전송 계층 보안(TLS)을 사용해야 합니다.

**중요**  
Amazon Keyspacescertificates가 Amazon Trust Services(ATS) 계층 구조로 전환되고 있습니다. 이 교체 중에 연결 오류가 발생하지 않도록 환경이 Amazon Root CAs 1\$14를 신뢰하는지 확인합니다. Perl 드라이버는 서버의 Amazon SSL 인증서를 검증하지 않으므로 Amazon Keyspaces에 접속하고 있는지 확인할 수 없습니다. 두 번째 단계는 Amazon Keyspaces에 접속해야 할 때 TLS를 사용하도록 드라이버를 구성하고 클라이언트와 서버 간에 전송되는 데이터가 암호화되도록 하는 것입니다.

1. [https://metacpan.org/pod/DBD::Cassandra](https://metacpan.org/pod/DBD::Cassandra)에서 Cassandra DBI 드라이버를 다운로드하여 Perl 환경에 설치합니다. 정확한 단계는 환경에 따라 달라집니다. 다음은 일반적인 예제입니다.

   ```
   cpanm DBD::Cassandra
   ```

1. 애플리케이션에 대한 파일을 생성합니다.

   ```
   touch cqlapp.pl
   ```

1. 다음 샘플 코드를 cqlapp.pl 파일에 추가합니다.

   ```
   use DBI;
   my $user = "ServiceUserName";
   my $password = "ServicePassword";
   my $db = DBI->connect("dbi:Cassandra:host=cassandra.us-east-2.amazonaws.com;port=9142;tls=1;", 
   $user, $password);
   
   my $rows = $db->selectall_arrayref("select * from system_schema.keyspaces"); 
   print "Found the following Keyspaces...\n"; 
   for my $row (@$rows) { 
         print join(" ",@$row['keyspace_name']),"\n"; 
   } 
   
   $db->disconnect;
   ```
**중요**  
 *ServiceUserName*과 *ServicePassword*는 [Amazon Keyspaces에 프로그래밍 방식으로 액세스하기 위한 서비스별 자격 증명 만들기](programmatic.credentials.ssc.md)에 대한 단계에 따라 서비스별 자격 증명을 생성할 때 얻은 사용자 이름 및 암호와 일치해야 합니다.
**참고**  
사용 가능한 엔드포인트 목록은 [Amazon Keyspaces의 서비스 엔드포인트](programmatic.endpoints.md) 섹션을 참조하세요.

1. 애플리케이션을 실행합니다.

   ```
   perl cqlapp.pl
   ```