

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

# 명령줄 도구를 사용하여 Amazon Neptune에 액세스
<a name="get-started-cli-tools"></a>

`curl` 및와 같은 AWS CLI, AWS SDKs 및 HTTP 도구를 사용하여 Neptune DB 클러스터`awscurl`에 쿼리를 제출할 수 있습니다. 다음 섹션에서는 각 도구를 설정하고 기본 Gremlin 및 openCypher 쿼리를 실행하는 방법을 보여줍니다.

## 사용 AWS CLI
<a name="get-started-cli-tools-cli"></a>

`aws neptunedata` 명령을 사용하면 Gremlin 및 openCypher 쿼리를 실행하고, 엔진 상태를 확인하고, 대량 로드를 관리하는 등의 작업을 수행할 수 있습니다. 전체 명령 참조는 AWS CLI 명령 참조[https://docs.aws.amazon.com/cli/latest/reference/neptunedata/](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/)의 섹션을 참조하세요.

다음 예제에서는 기본 쿼리를 실행하는 방법을 보여줍니다.

------
#### [ Gremlin ]

```
aws neptunedata execute-gremlin-query \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --region {{us-east-1}} \
  --gremlin-query "g.V().limit(1)"
```

자세한 내용은 AWS CLI 명령 참조의 [execute-gremlin-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/execute-gremlin-query.html)를 참조하세요.

------
#### [ openCypher ]

```
aws neptunedata execute-open-cypher-query \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --region {{us-east-1}} \
  --open-cypher-query "MATCH (n) RETURN n LIMIT 1"
```

자세한 내용은 AWS CLI 명령 참조의 [execute-open-cypher-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/execute-open-cypher-query.html)를 참조하세요.

------

## AWS SDK 사용
<a name="get-started-cli-tools-sdk"></a>

 AWS SDKs를 실행할 수 있습니다. 다음 Python 예제에서는 기본 쿼리를 실행하는 방법을 보여줍니다.

------
#### [ Gremlin ]

```
import boto3
import json
from botocore.config import Config

# Disable the client-side read timeout and retries so that
# Neptune's server-side neptune_query_timeout controls query duration.
client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.execute_gremlin_query(
    gremlinQuery='g.V().limit(1)',
    serializer='application/vnd.gremlin-v3.0+json;types=false'
)

print(json.dumps(response['result'], indent=2))
```

다른 언어의 AWS SDK 예제는 섹션을 참조하세요[AWS SDK](access-graph-gremlin-sdk.md).

------
#### [ openCypher ]

```
import boto3
import json
from botocore.config import Config

# Disable the client-side read timeout and retries so that
# Neptune's server-side neptune_query_timeout controls query duration.
client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.execute_open_cypher_query(
    openCypherQuery='MATCH (n) RETURN n LIMIT 1'
)

print(json.dumps(response['results'], indent=2))
```

다른 언어의 AWS SDK 예제는 섹션을 참조하세요[AWS SDK](access-graph-opencypher-sdk.md).

------

## `curl` 및 `awscurl` 사용
<a name="get-started-cli-tools-curl"></a>

[curl](https://curl.haxx.se/) 명령줄 도구는 HTTP 요청을 Neptune 엔드포인트에 직접 제출합니다. IAM 인증이 활성화된 경우 요청에 서명하는 `--aws-sigv4` 옵션과 함께 [awscurl](https://github.com/okigan/awscurl) 또는 `curl` 7.75.0 이상을 사용합니다. 자세한 내용은 [임시 보안 인증 정보와 `awscurl`을 사용하여 IAM 인증이 활성화된 상태에서 DB 클러스터에 안전하게 연결](iam-auth-connect-command-line.md#iam-auth-connect-awscurl) 단원을 참조하십시오.

### HTTPS `curl` 설정
<a name="get-started-cli-tools-curl-setup"></a>

HTTPS를 사용하여 연결하려면(대부분의 리전에서 Neptune이 요구하는 대로)에 적절한 인증서에 대한 액세스 권한이 `curl` 필요합니다. 인증서를 얻고 인증 기관(CA) 저장소로 포맷하는 방법에 대한 자세한 내용은 `curl` 설명서의 [SSL 인증서 확인을](https://curl.haxx.se/docs/sslcerts.html) 참조하세요.

`CURL_CA_BUNDLE` 환경 변수를 사용하여이 CA 인증서 스토어의 위치를 지정할 수 있습니다. Windows에서 `curl`은 `curl-ca-bundle.crt`라는 파일에서 자동으로 이 인증서를 찾습니다. 먼저 `curl.exe`와 동일한 디렉터리에서 찾은 다음 경로의 다른 곳을 찾습니다. 자세한 내용은 [SSL Certificate Verification](https://curl.haxx.se/docs/sslcerts.html)을 참조하십시오.

`curl`이 적절한 인증서를 찾을 수 있어야 추가 파라미터 없이 HTTP 연결과 같이 HTTPS 연결을 처리할 수 있습니다. 이 설명서의 예제는 해당 시나리오를 기반으로 합니다.

도구에 대한 자세한 내용은 [curl man 페이지](https://curl.haxx.se/docs/manpage.html)와 *[Everything curl](https://ec.haxx.se/)* 책을 참조하세요.

### 쿼리 예제
<a name="get-started-cli-tools-curl-examples"></a>

다음 예제에서는 `curl` 및를 사용하여 기본 쿼리를 실행하는 방법을 보여줍니다`awscurl`.

------
#### [ Gremlin (awscurl) ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/gremlin \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -d '{"gremlin":"g.V().limit(1)"}'
```

------
#### [ Gremlin (curl) ]

```
curl -X POST \
  -d '{"gremlin":"g.V().limit(1)"}' \
  https://{{your-neptune-endpoint}}:{{port}}/gremlin
```

**참고**  
일반은 클러스터에서 IAM 인증이 활성화되지 않은 경우에만 `curl` 작동합니다.

------
#### [ openCypher (awscurl) ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -d "query=MATCH (n) RETURN n LIMIT 1"
```

------
#### [ openCypher (curl) ]

```
curl -X POST \
  -d "query=MATCH (n) RETURN n LIMIT 1" \
  https://{{your-neptune-endpoint}}:{{port}}/openCypher
```

**참고**  
일반은 클러스터에서 IAM 인증이 활성화되지 않은 경우에만 `curl` 작동합니다.

------

자세한 Gremlin HTTP 예제는 섹션을 참조하세요[HTTPS REST](access-graph-gremlin-rest.md). 자세한 openCypher HTTP 예제는 섹션을 참조하세요[HTTPS 엔드포인트](access-graph-opencypher-queries.md).