View a markdown version of this page

Quick start using AWS CloudShell - Neptune Analytics

Quick start using AWS CloudShell

You can connect to your Neptune Analytics graph with a single click through AWS CloudShell directly from the AWS Management Console. CloudShell provides a pre-authenticated shell environment with the graphsh tool pre-installed, connecting to your graph's public endpoint. You don't need to provision notebooks to interact with the graph.

Time to complete: Approximately 2 minutes

Cost: CloudShell is available at no additional charge. Neptune Analytics graphs incur charges based on provisioned memory. For pricing details, see Neptune Analytics pricing.

Prerequisites

  • An AWS account with appropriate IAM permissions.

  • A Neptune Analytics graph with public connectivity enabled and status Available. If you don't already have one, see Create an empty Neptune graph. When creating your graph, you must enable public connectivity.

Step 1: Connect to your Neptune Analytics graph

Connect to your Neptune Analytics graph using AWS CloudShell.

Note

You must enable public connectivity to connect to a Neptune Analytics graph using CloudShell.

To connect to your graph
  1. In the Neptune console, in the navigation pane, choose Graphs.

  2. Select the check box next to the graph that you created.

  3. Choose Connect to graph.

    Note

    This button is active when you select a graph with Available status and public connectivity turned on.

    The CloudShell Run command screen appears.

  4. Choose Run to connect to the graph.

After you connect, the graphsh console appears.

Step 2: Insert and query data

Now that you are connected to your graph, run a few queries to get familiar with Neptune Analytics. The following examples use openCypher, the query language supported by Neptune Analytics.

To insert nodes and relationships

Run the following query to create two person nodes and a relationship:

CREATE (a:Person {name: 'Alice', age: 30}), (b:Person {name: 'Bob', age: 40}), (a)-[:KNOWS]->(b)

The output looks similar to the following:

╭────────╮
│ result │
├────────┤
│ []     │
╰────────╯
To find nodes

Run the following query to return all person names in alphabetical order:

MATCH (p:Person) RETURN p.name AS name ORDER BY name

The output looks similar to the following:

╭───────╮
│ name  │
├───────┤
│ Alice │
│ Bob   │
╰───────╯
To run an algorithm

Run a breadth-first search (BFS) to find nodes reachable from Alice:

MATCH (n {name: "Alice"}) CALL neptune.algo.bfs(n, {edgeLabels: ["KNOWS"]}) YIELD node RETURN node

The output looks similar to the following (order might vary):

╭──────────────────────────────────────────────────────────────────────╮
│ node                                                                 │
├──────────────────────────────────────────────────────────────────────┤
│ (:Person {~id: "...", age: 40, name: "Bob"})                         │
│ (:Person {~id: "...", age: 30, name: "Alice"})                       │
╰──────────────────────────────────────────────────────────────────────╯

Next steps

You have completed this quick start. To learn more, explore the following features:

To avoid ongoing charges, delete the graph if you created it only for this quick start. For instructions, see Managing your Neptune Analytics graphs.