- A Cloud Guru
Loading and Retrieving Data in Neptune
In this lab, you will load data from an S3 bucket into an existing Neptune instance using the bulk load feature. This is far more efficient than executing a large number of `INSERT` statements, addVertex, and addEdge steps, or other API calls. The Neptune instance will be available when you start the lab. However, you will need to create an IAM role and an S3 bucket, so prior knowledge of the IAM and S3 services are suggested.
Table of Contents
Create an S3 Bucket and Grant Access
In the AWS Management Console, navigate to S3.
Click Create bucket.
Set the following settings:
- Bucket name: "neptune-import<INSERT_CURRENT_DATE_HERE>"
- Region: US East (N. Virginia)
Copy the S3 bucket name into a text file for later use.
Under Tags, set Key to "name" and Value to "neptune-import".
Select Next >> Next >> Create bucket.
Visit this lab's GitHub repo and download the neptune-data.rdf file to your local machine.
Click on the bucket's name and select Upload.
Click Add files.
Select the neptune-data.rdf from your machine.
Click on Services and select IAM.
Select Roles >> Create role >> S3 >> Next: Permissions.
Select Next:Tags >> Next:Review.
For Role name, enter "neptune-import".
Click Create role.
Search for and select neptune-import.
Select the Trust relationships tab.
Click Edit trust relationship.
In the policy document, edit the
Service:line to read
"Service": [ "s3.amazonaws.com", "rds.amazonaws.com" ]
- Select Update Trust Policy.
- Click Services and select Neptune.
- Select the
- Click Actions >> Manage IAM roles.
- With the
neptune-importrole selected, click Done.
Load the Data
- In the AWS Management Console, navigate to VPC.
- On the left menu, click Endpoints >> Create Endpoint.
- In Service category, select Find service by name.
- In Service Name, enter "com.amazonaws.us-east-1.s3" and click Verify.
- In VPC, select the existing VPC from the dropdown menu.
- Under Route Table ID, select the ID associated with 2 subnets.
- Click Create endpoint >> Close.
- Navigate to IAM.
- On the left menu, click Roles.
- Click the
- Under Summary, copy the role ARN into a text file for later use.
- Navigate to Neptune.
- Select the
- Under Connectivity & security, copy the cluster endpoint and port number into a text file for later use.
- Connect to the bastion host using the provided lab credentials and save the endpoint URL as an environment variable.
- Install curl with https support.
- Use curl to submit the upload, adding your unique role ARN to
iamRoleArnand unique bucket name to
source. If successful, a
"200 OK"status will appear.
- Copy the loadID (from the
200 OKmessage) to monitor the job.
Query the Data
- Download the RDF4J client.
- Extract the client.
- Create a SPARQL repo. Be sure to include your Neptune endpoint and append
:8182/sparqlat the end of the line.
- Type "yes" to overwrite the configuration. If successful, a
repository createdmessage should appear.
- Open the repo to view the submitted S3 bucket data.
- Query the data.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.