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.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- 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.
Select Next.
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.
Select Upload.
Click on Services and select IAM.
Select Roles >> Create role >> S3 >> Next: Permissions.
Select AmazonS3ReadOnlyAccess.
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
neptune-cluster
.Click Actions >> Manage IAM roles.
With the
neptune-import
role 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
neptune-import
role. - Under Summary, copy the role ARN into a text file for later use.
- Navigate to Neptune.
- Select the
neptune-cluster
. - 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
iamRoleArn
and unique bucket name tosource
. If successful, a"200 OK"
status will appear. - Copy the loadID (from the
200 OK
message) 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/sparql
at the end of the line. - Type "yes" to overwrite the configuration. If successful, a
repository created
message should appear. - Open the repo to view the submitted S3 bucket data.
- Query the data.