AWS neptune documentation change
Summary
Added comprehensive examples for using query plan cache with AWS CLI, SDK (Python), awscurl, and curl, including examples for enabling/disabling plan caching and using explain functionality
Security assessment
The changes are documentation updates adding usage examples for existing Neptune query plan cache functionality. There is no evidence of addressing a specific security vulnerability, weakness, or incident. The changes include removing the '-k' flag from curl examples, which could be interpreted as promoting secure connections by not bypassing SSL certificate verification, but this appears to be a documentation improvement rather than addressing a specific security issue.
Diff
diff --git a/neptune/latest/userguide/access-graph-qpc.md b/neptune/latest/userguide/access-graph-qpc.md index 42c913d17..0e1f3b923 100644 --- a//neptune/latest/userguide/access-graph-qpc.md +++ b//neptune/latest/userguide/access-graph-qpc.md @@ -16,0 +17,39 @@ Query plan cache is enabled by default for low-latency parameterized queries. A +AWS CLI + + +Forcing plan to be cached or reused: + + + aws neptunedata execute-open-cypher-query \ + --endpoint-url https://your-neptune-endpoint:port \ + --open-cypher-query "Using QUERY:PLANCACHE \"enabled\" MATCH(n) RETURN n LIMIT 1" + +With parameters: + + + aws neptunedata execute-open-cypher-query \ + --endpoint-url https://your-neptune-endpoint:port \ + --open-cypher-query "Using QUERY:PLANCACHE \"enabled\" RETURN \$arg" \ + --parameters '{"arg": 123}' + +Forcing plan to be neither cached nor reused: + + + aws neptunedata execute-open-cypher-query \ + --endpoint-url https://your-neptune-endpoint:port \ + --open-cypher-query "Using QUERY:PLANCACHE \"disabled\" MATCH(n) RETURN n LIMIT 1" + +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}) + ) @@ -19 +58,31 @@ Query plan cache is enabled by default for low-latency parameterized queries. A - % curl -k https://<endpoint>:<port>/opencypher \ + response = client.execute_open_cypher_query( + openCypherQuery='Using QUERY:PLANCACHE "enabled" MATCH(n) RETURN n LIMIT 1' + ) + + print(response['results']) + +For AWS SDK examples in other languages, see [AWS SDK](./access-graph-opencypher-sdk.html). + +awscurl + + +Forcing plan to be cached or reused: + + + awscurl https://your-neptune-endpoint:port/openCypher \ + --region us-east-1 \ + --service neptune-db \ + -X POST \ + -d "query=Using QUERY:PLANCACHE \"enabled\" MATCH(n) RETURN n LIMIT 1" + +###### 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 + + +Forcing plan to be cached or reused: + + + curl https://your-neptune-endpoint:port/openCypher \ @@ -22 +91,4 @@ Query plan cache is enabled by default for low-latency parameterized queries. A - % curl -k https://<endpoint>:<port>/opencypher \ +With parameters: + + + curl https://your-neptune-endpoint:port/openCypher \ @@ -26,3 +98 @@ Query plan cache is enabled by default for low-latency parameterized queries. A - # Forcing plan to be neither cached nor reused - % curl -k https://<endpoint>:<port>/opencypher \ - -d "query=Using QUERY:PLANCACHE \"disabled\" MATCH(n) RETURN n LIMIT 1" +Forcing plan to be neither cached nor reused: @@ -30,0 +101,3 @@ Query plan cache is enabled by default for low-latency parameterized queries. A + curl https://your-neptune-endpoint:port/openCypher \ + -d "query=Using QUERY:PLANCACHE \"disabled\" MATCH(n) RETURN n LIMIT 1" + @@ -34,0 +108,23 @@ For HTTP READ, if the query was submitted and the plan was cached, `explain` wou +AWS CLI + + + + aws neptunedata execute-open-cypher-explain-query \ + --endpoint-url https://your-neptune-endpoint:port \ + --open-cypher-query "Using QUERY:PLANCACHE \"enabled\" MATCH(n) RETURN n LIMIT 1" \ + --explain-mode details + +For more information, see [execute-open-cypher-explain-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/execute-open-cypher-explain-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}) + ) @@ -36 +132,17 @@ For HTTP READ, if the query was submitted and the plan was cached, `explain` wou - % curl -k https://<endpoint>:<port>/opencypher \ + response = client.execute_open_cypher_explain_query( + openCypherQuery='Using QUERY:PLANCACHE "enabled" MATCH(n) RETURN n LIMIT 1', + explainMode='details' + ) + + print(response['results'].read().decode('utf-8')) + +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 \ @@ -38 +150,16 @@ For HTTP READ, if the query was submitted and the plan was cached, `explain` wou - -d "explain=[static|details]" + -d "explain=details" + +###### 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=Using QUERY:PLANCACHE \"enabled\" MATCH(n) RETURN n LIMIT 1" \ + -d "explain=details" + +If the plan was cached, the `explain` output shows: + @@ -80 +207 @@ Query plan cache would not be used under the following conditions: - curl -k https://<endpoint>:<port>/opencypher \ + curl https://your-neptune-endpoint:port/openCypher \ @@ -84 +211 @@ Query plan cache would not be used under the following conditions: - curl -k https://<endpoint>:<port>/opencypher \ + curl https://your-neptune-endpoint:port/openCypher \