AWS neptune documentation change
Summary
Updated OpenCypher query examples to use AWS CLI, SDK, awscurl, and curl with proper endpoint URLs and removed GET method examples, focusing on POST requests
Security assessment
The changes are documentation improvements showing different ways to execute queries (AWS CLI, SDK, awscurl, curl) with proper endpoint URLs and configuration. There's no evidence of addressing a specific security vulnerability. The removal of GET method examples could be considered a security best practice (avoiding query strings in URLs), but this isn't explicitly stated as a security fix. The changes primarily improve clarity and provide more comprehensive examples.
Diff
diff --git a/neptune/latest/userguide/access-graph-opencypher-queries.md b/neptune/latest/userguide/access-graph-opencypher-queries.md index 2507981e5..a554597e0 100644 --- a//neptune/latest/userguide/access-graph-opencypher-queries.md +++ b//neptune/latest/userguide/access-graph-opencypher-queries.md @@ -35 +35 @@ The syntax is: -Here are sample read queries, one that uses `POST` and one that uses `GET`: +Here is a sample read query: @@ -37 +37 @@ Here are sample read queries, one that uses `POST` and one that uses `GET`: -1\. Using `POST`: +AWS CLI @@ -40,2 +39,0 @@ Here are sample read queries, one that uses `POST` and one that uses `GET`: - curl HTTPS://server:port/openCypher \ - -d "query=MATCH (n1) RETURN n1;" @@ -43 +41,3 @@ Here are sample read queries, one that uses `POST` and one that uses `GET`: -2\. Using `GET` (the query string is URL-encoded): + aws neptunedata execute-open-cypher-query \ + --endpoint-url https://your-neptune-endpoint:port \ + --open-cypher-query "MATCH (n1) RETURN n1" @@ -44,0 +45 @@ Here are sample read queries, one that uses `POST` and one that uses `GET`: +For more information, see [execute-open-cypher-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/execute-open-cypher-query.html) in the AWS CLI Command Reference. @@ -46,2 +47 @@ Here are sample read queries, one that uses `POST` and one that uses `GET`: - curl -X GET \ - "HTTPS://server:port/openCypher?query=MATCH%20(n1)%20RETURN%20n1" +SDK @@ -49 +48,0 @@ Here are sample read queries, one that uses `POST` and one that uses `GET`: -Here are sample write/update queries, one that uses `POST` and one that uses `GET`: @@ -51 +49,0 @@ Here are sample write/update queries, one that uses `POST` and one that uses `GE -1\. Using `POST`: @@ -52,0 +51,2 @@ Here are sample write/update queries, one that uses `POST` and one that uses `GE + import boto3 + from botocore.config import Config @@ -54 +54,76 @@ Here are sample write/update queries, one that uses `POST` and one that uses `GE - curl HTTPS://server:port/openCypher \ + 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 (n1) RETURN n1' + ) + + print(response['results']) + +For AWS SDK examples in other languages, see [AWS SDK](./access-graph-opencypher-sdk.html). + +awscurl + + + + awscurl https://your-neptune-endpoint:port/openCypher \ + --region us-east-1 \ + --service neptune-db \ + -X POST \ + -d "query=MATCH (n1) RETURN n1" + +###### Note + +This example assumes that your AWS credentials are configured in your environment. Replace `us-east-1` with the Region of your Neptune cluster. + +curl + + + + curl https://your-neptune-endpoint:port/openCypher \ + -d "query=MATCH (n1) RETURN n1" + +Here is a sample write/update query: + +AWS CLI + + + + aws neptunedata execute-open-cypher-query \ + --endpoint-url https://your-neptune-endpoint:port \ + --open-cypher-query "CREATE (n:Person { age: 25 })" + +For more information, see [execute-open-cypher-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/execute-open-cypher-query.html) in the AWS CLI Command Reference. + +SDK + + + + import boto3 + from botocore.config import Config + + 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='CREATE (n:Person { age: 25 })' + ) + + print(response['results']) + +For AWS SDK examples in other languages, see [AWS SDK](./access-graph-opencypher-sdk.html). + +awscurl + + + + awscurl https://your-neptune-endpoint:port/openCypher \ + --region us-east-1 \ + --service neptune-db \ + -X POST \ @@ -57 +132 @@ Here are sample write/update queries, one that uses `POST` and one that uses `GE -2\. Using `GET` (the query string is URL-encoded): +###### Note @@ -58,0 +134 @@ Here are sample write/update queries, one that uses `POST` and one that uses `GE +This example assumes that your AWS credentials are configured in your environment. Replace `us-east-1` with the Region of your Neptune cluster. @@ -60,2 +136,6 @@ Here are sample write/update queries, one that uses `POST` and one that uses `GE - curl -X GET \ - "HTTPS://server:port/openCypher?query=CREATE%20(n%3APerson%20%7B%20age%3A%2025%20%7D)" +curl + + + + curl https://your-neptune-endpoint:port/openCypher \ + -d "query=CREATE (n:Person { age: 25 })"