Neptune 퍼블릭 엔드포인트 - Amazon Neptune

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

Neptune 퍼블릭 엔드포인트

개요

Amazon Neptune 클러스터는 일반적으로 VPC 내에 배포되며 해당 VPC 내에서만 액세스할 수 있습니다. 이를 위해서는 VPC 내에서 애플리케이션 및 개발 환경을 구성하거나 프록시 서비스를 사용하여 VPC에 연결해야 하므로 설정 시간과 비용이 증가합니다.

퍼블릭 엔드포인트는 인터넷을 통해 Neptune에 직접 연결할 수 있도록 하여이 경험을 간소화하므로 특수 네트워킹 지식 없이 그래프 데이터베이스를 더 쉽게 시작할 수 있습니다.

퍼블릭 엔드포인트를 사용해야 하는 경우

다음 시나리오에서는 퍼블릭 엔드포인트를 사용하는 것이 좋습니다.

  • 복잡한 네트워크 구성 없이 개발 또는 테스트 환경에서 Neptune을 빠르게 테스트하려는 경우

  • 전문 AWS 네트워킹 지식이 없음

  • 애플리케이션의 보안 태세에 프라이빗 VPC가 필요하지 않음

  • 로컬 개발 환경에서 Neptune에 연결해야 합니다.

보안 고려 사항

퍼블릭 엔드포인트를 사용할 때는 다음 보안 고려 사항에 유의하세요.

  • 퍼블릭 엔드포인트가 활성화된 클러스터에는 IAM 인증이 필요합니다.

  • 데이터베이스에 대한 액세스는 데이터베이스가 사용하는 보안 그룹에 의해 제어됩니다.

  • 클러스터에 연결할 수 있는 IP 주소를 제한할 수 있습니다.

  • IAM 정책을 사용하여 퍼블릭 액세스 권한이 있는 클러스터를 생성하거나 수정할 수 있는 사용자를 제어할 수 있습니다. 참조: 퍼블릭 액세스 생성 제한

퍼블릭 엔드포인트 활성화

기본적으로 새 Neptune 데이터베이스는 퍼블릭 엔드포인트가 비활성화된 상태로 생성됩니다. 클러스터를 생성하거나 수정할 때 퍼블릭 액세스를 명시적으로 활성화해야 합니다.

퍼블릭 엔드포인트는 Neptune 엔진 릴리스 버전 1.4.6.x에서 지원됩니다. 이 기능을 사용하려면 기존 클러스터를 최소한이 버전으로 업그레이드해야 합니다.

퍼블릭 엔드포인트 설정은 Neptune 클러스터가 아닌 Neptune 인스턴스에서 사용할 수 있습니다. 따라서 Neptune 클러스터는 퍼블릭 엔드포인트가 있는 일부 인스턴스와 그렇지 않은 일부 인스턴스에 존재할 수 있습니다. 그러나 이러한 설정은 사용하지 않는 것이 좋습니다. 이에 대한 자세한 내용은 퍼블릭 엔드포인트 작동 방식을 참조하세요.

사전 조건

Neptune 클러스터의 IAM 인증 설정

Neptune 인스턴스에서 퍼블릭 엔드포인트를 활성화하기 전에 클러스터가 IAM 인증을 지원하는지 확인합니다. 그렇지 않은 경우 다음 명령을 사용하여 활성화합니다.

aws neptune modify-db-cluster \ --region us-west-2 \ --engine graphdb \ --engine-version 1.4.6.x \ --db-cluster-identifier neptune-public-endpoint \ --enable-iam-database-authentication

네트워크 설정

  1. VPC에 퍼블릭 라우팅을 활성화하는 서브넷이 있는지 확인합니다(서브넷의 라우팅 테이블에 인터넷 게이트웨이에 대한 항목이 있음). 클러스터를 생성하는 동안 db-subnet-group-name 파라미터를 제공하지 않으면 클러스터 생성을 위해 기본 서브넷 그룹이 선택됩니다.

  2. 클러스터에 연결된 보안 그룹이 허용된 IP 범위 및 허용된 포트에 대한 인바운드 트래픽을 허용하는지 확인합니다. 예를 들어 모든 IPs이 포트 8182에서 실행되는 Neptune 인스턴스에 연결되도록 허용하려면 인바운드 규칙에 다음이 포함되어야 합니다.

    1. 유형: 모든 TCP

    2. 프로토콜: TCP

    3. 포트 범위: 8182

    4. CIDR 블록: 0.0.0.0/0

참고

CIDR 블록 범위를 0.0.0.0/0으로 설정할 수 있지만 보안 태세를 강화하려면 클라이언트 애플리케이션의 특정 IP 범위로 줄이는 것이 좋습니다.

퍼블릭 엔드포인트를 사용하여 새 인스턴스 생성

AWS 관리 콘솔, AWS CLI 또는 AWS SDK를 사용하여 퍼블릭 엔드포인트가 있는 새 Neptune 인스턴스를 생성할 수 있습니다.

AWS CLI 사용:

aws neptune create-db-instance \ --region us-west-2 \ --engine graphdb \ --engine-version 1.4.6.x \ --db-cluster-identifier neptune-public-endpoint \ --publicly-accessible

퍼블릭 액세스를 위해 기존 인스턴스 수정

퍼블릭 액세스를 활성화하도록 기존 Neptune 인스턴스를 수정하려면:

aws neptune modify-db-instance \ --region us-west-2 \ --engine graphdb \ --engine-version 1.4.6.x \ --db-instance-identifier neptune-public-endpoint \ --publicly-accessible
참고

퍼블릭 액세스는 클러스터 수준이 아닌 인스턴스 수준에서 활성화됩니다. 퍼블릭 엔드포인트를 통해 클러스터에 항상 액세스할 수 있도록 하려면 클러스터의 모든 인스턴스에 퍼블릭 액세스가 활성화되어 있어야 합니다.

퍼블릭 엔드포인트 사용

데이터베이스에 연결할 수 있는지 확인하려면 AWS CLI NeptuneData API를 사용하여 상태를 확인합니다.

aws neptunedata get-engine-status \ --endpoint-url https://my-cluster-name.cluster-abcdefgh1234.us-east-1.neptune.amazonaws.com:8182

데이터베이스에 액세스할 수 있는 경우 응답은 다음과 같습니다.

{ "status": "healthy", "startTime": "Sun Aug 10 06:54:15 UTC 2025", "dbEngineVersion": "1.4.6.0.R1", "role": "writer", "dfeQueryEngine": "viaQueryHint", "gremlin": { "version": "tinkerpop-3.7.1" }, "sparql": { "version": "sparql-1.1" }, "opencypher": { "version": "Neptune-9.0.20190305-1.0" }, "labMode": { "ObjectIndex": "disabled", "ReadWriteConflictDetection": "enabled" }, "features": { "SlowQueryLogs": "disabled", "InlineServerGeneratedEdgeId": "disabled", "ResultCache": { "status": "disabled" }, "IAMAuthentication": "disabled", "Streams": "disabled", "AuditLog": "disabled" }, "settings": { "StrictTimeoutValidation": "true", "clusterQueryTimeoutInMs": "120000", "SlowQueryLogsThreshold": "5000" } }

데이터베이스를 쿼리하는 방법의 예

AWS CLI

aws neptunedata execute-open-cypher-query \ --open-cypher-query "MATCH (n) RETURN n LIMIT 10" \ --endpoint-url https://my-cluster-name.cluster-abcdefgh1234.us-east-1.neptune.amazonaws.com:8182

Python

import boto3 import json from botocore.config import Config # Configuration - Replace with your actual Neptune cluster details cluster_endpoint = "my-cluster-name.cluster-abcdefgh1234.my-region.neptune.amazonaws.com" port = 8182 region = "my-region" # Configure Neptune client # This disables retries and sets the client timeout to infinite # (relying on Neptune's query timeout) endpoint_url = f"https://{cluster_endpoint}:{port}" config = Config( region_name=region, retries={'max_attempts': 1}, read_timeout=None ) client = boto3.client("neptunedata", config=config, endpoint_url=endpoint_url) cypher_query = "MATCH (n) RETURN n LIMIT 5" try: response = client.execute_open_cypher_query(openCypherQuery=cypher_query) print("openCypher Results:") for item in response.get('results', []): print(f" {item}") except Exception as e: print(f"openCypher query failed: {e}")

JavaScript

import { NeptunedataClient, GetPropertygraphSummaryCommand } from "@aws-sdk/client-neptunedata"; import { inspect } from "util"; import { NodeHttpHandler } from "@smithy/node-http-handler"; /** * Main execution function */ async function main() { // Configuration - Replace with your actual Neptune cluster details const clusterEndpoint = 'my-cluster-name.cluster-abcdefgh1234.my-region.neptune.amazonaws.com'; const port = 8182; const region = 'my-region'; // Configure Neptune client // This disables retries and sets the client timeout to infinite // (relying on Neptune's query timeout) const endpoint = `https://${clusterEndpoint}:${port}`; const clientConfig = { endpoint: endpoint, sslEnabled: true, region: region, maxAttempts: 1, // do not retry requestHandler: new NodeHttpHandler({ requestTimeout: 0 // no client timeout }) }; const client = new NeptunedataClient(clientConfig); try { try { const command = new GetPropertygraphSummaryCommand({ mode: "basic" }); const response = await client.send(command); console.log("Graph Summary:", inspect(response.payload, { depth: null })); } catch (error) { console.log("Property graph summary failed:", error.message); } } catch (error) { console.error("Error in main execution:", error); } } // Run the main function main().catch(console.error);

Go

package main import ( "context" "fmt" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/neptunedata" "os" "encoding/json" "net/http" ) func main() { // Configuration - Replace with your actual Neptune cluster details clusterEndpoint := "my-cluster-name.cluster-abcdefgh1234.my-region.neptune.amazonaws.com" port := 8182 region := "my-region" // Configure Neptune client // Configure HTTP client with no timeout // (relying on Neptune's query timeout) endpoint := fmt.Sprintf("https://%s:%d", clusterEndpoint, port) // Load AWS SDK configuration sdkConfig, _ := config.LoadDefaultConfig( context.TODO(), config.WithRegion(region), config.WithHTTPClient(&http.Client{Timeout: 0}), ) // Create Neptune client with custom endpoint client := neptunedata.NewFromConfig(sdkConfig, func(o *neptunedata.Options) { o.BaseEndpoint = aws.String(endpoint) o.Retryer = aws.NopRetryer{} // Do not retry calls if they fail }) gremlinQuery := "g.addV('person').property('name','charlie').property(id,'charlie-1')" serializer := "application/vnd.gremlin-v1.0+json;types=false" gremlinInput := &neptunedata.ExecuteGremlinQueryInput{ GremlinQuery: &gremlinQuery, Serializer: &serializer, } gremlinResult, err := client.ExecuteGremlinQuery(context.TODO(), gremlinInput) if err != nil { fmt.Printf("Gremlin query failed: %v\n", err) } else { var resultMap map[string]interface{} err = gremlinResult.Result.UnmarshalSmithyDocument(&resultMap) if err != nil { fmt.Printf("Error unmarshaling Gremlin result: %v\n", err) } else { resultJSON, _ := json.MarshalIndent(resultMap, "", " ") fmt.Printf("Gremlin Result: %s\n", string(resultJSON)) } } }

퍼블릭 엔드포인트 작동 방식

Neptune 인스턴스에 공개적으로 액세스할 수 있는 경우:

  • DNS 엔드포인트는 DB 클러스터의 VPC 내에서 프라이빗 IP 주소로 확인됩니다.

  • 클러스터의 VPC 외부에서 퍼블릭 IP 주소로 확인됩니다.

  • 액세스는 클러스터에 할당된 보안 그룹에 의해 제어됩니다.

  • 공개적으로 액세스할 수 있는 인스턴스만 인터넷을 통해 액세스할 수 있습니다.

리더 엔드포인트 동작

  • 모든 리더 인스턴스에 공개적으로 액세스할 수 있는 경우 리더 엔드포인트는 항상 퍼블릭 인터넷을 통해 확인됩니다.

  • 일부 리더 인스턴스만 공개적으로 액세스할 수 있는 경우 리더 엔드포인트는 읽기 쿼리를 제공할 공개적으로 액세스할 수 있는 인스턴스를 선택한 경우에만 공개적으로 확인됩니다.

클러스터 엔드포인트 동작

  • DB 클러스터 엔드포인트는 항상 라이터의 인스턴스 엔드포인트로 확인됩니다.

  • 라이터 인스턴스에서 퍼블릭 엔드포인트가 활성화된 경우 클러스터 엔드포인트에 공개적으로 액세스할 수 있으며, 그렇지 않으면 액세스할 수 없습니다.

클러스터 장애 조치 후 동작

  • Neptune 클러스터에는 퍼블릭 액세스 가능 설정이 서로 다를 수 있습니다.

  • 클러스터에 퍼블릭 라이터와 비공개 리더가 있는 경우 클러스터 장애 조치를 게시하면 새 라이터(이전 리더)는 비공개가 되고 새 리더(이전 라이터)는 퍼블릭이 됩니다.

네트워크 구성 요구 사항

퍼블릭 엔드포인트가 제대로 작동하려면:

  1. Neptune 인스턴스는 VPC 내의 퍼블릭 서브넷에 있어야 합니다.

  2. 이러한 서브넷과 연결된 라우팅 테이블에는 0.0.0.0/0에 대한 인터넷 게이트웨이 경로가 있어야 합니다.

  3. 보안 그룹은 액세스 권한을 부여하려는 퍼블릭 IP 주소 또는 CIDR 범위에서 액세스를 허용해야 합니다.

퍼블릭 액세스 생성 제한

IAM 정책을 사용하여 퍼블릭 액세스 권한이 있는 Neptune 클러스터를 생성하거나 수정할 수 있는 사용자를 제한할 수 있습니다. 다음 예제 정책은 퍼블릭 액세스 권한이 있는 Neptune 인스턴스 생성을 거부합니다.

JSON
{ "Version":"2012-10-17", "Statement": [ { "Effect": "Deny", "Action": [ "rds:CreateDBInstance", "rds:ModifyDBInstance", "rds:RestoreDBInstanceFromDBSnapshot", "rds:RestoreDBInstanceToPointInTime" ], "Resource": "*", "Condition": { "Bool": { "rds:PubliclyAccessible": true } } } ] }

rds:PublicAccessEnabled IAM 조건 키에 대한 자세한 내용: Amazon RDS Service Authorization Reference

AWS CloudFormation 지원

AWS CloudFormation 를 사용하여 AWS CloudFormation 템플릿에서 PubliclyAccessible 파라미터를 지정하여 퍼블릭 엔드포인트가 활성화된 Neptune 클러스터를 시작할 수 있습니다.

Neptune 기능과의 호환성

퍼블릭 엔드포인트가 활성화된 클러스터는 다음을 포함하여 VPC 전용 클러스터가 지원하는 모든 Neptune 기능을 지원합니다.

  • Neptune 워크벤치

  • 전체 텍스트 검색 통합

  • Neptune 스트림

  • 사용자 지정 엔드포인트

  • Neptune 서버리스

  • 그래프 탐색기

요금

퍼블릭 엔드포인트는 표준 Neptune 요금 외에 추가 비용 없이 사용할 수 있습니다. 그러나 퍼블릭 IP를 통해 로컬 환경에서 Neptune으로 연결하면 데이터 전송 비용이 증가할 수 있습니다.