- Newest
- Most votes
- Most comments
AWS doesn’t have built-in change streams for Neptune yet. If you need them, consider using Neptune Streams with Lambda or polling the audit log via CloudWatch to trigger downstream actions.
answered a year ago
The Audit Log reflects queries and other data plane API requests that were sent to the database. It does not in any way reflect the results of any mutations driven by those requests. Trying to parse the audit log looking for anything that potentially triggered a mutation could be complex (and expensive). Your suggestion of polling the stream from something like a Lambda function, triggered perhaps by an EventBridge rule, is definitely a good approach
To capture data from Neptune change streams and pass it downstream, there are several approaches you can consider:
-
Direct ingestion by Glue: Unfortunately, AWS Glue cannot directly ingest data from Neptune change streams. The Neptune Streams feature provides an HTTP REST API for retrieving change records, which is not natively compatible with Glue's input sources.
-
Using Lambda: The approach mentioned in the blog post you referenced, using a Lambda function as an intermediary, is a common and recommended method. This Lambda function can be triggered periodically to poll the Neptune Streams API and process the change records.
-
Alternative approaches:
a. EventBridge Pipes: You could use Amazon EventBridge Pipes to integrate Neptune Streams with other AWS services, including AWS Step Functions or Amazon SageMaker, for more complex processing workflows.
b. Apache Airflow: While it's possible to use Apache Airflow to consume Neptune change stream data, it would require custom operator development to interact with the Neptune Streams API.
For flowing change events to a Glue job while considering parallel scaling and avoiding sequential processing:
-
Use a message queue: Instead of directly invoking the Glue job, have your Lambda function push change events to a message queue like Amazon SQS or Amazon Kinesis. This allows for better scalability and parallel processing.
-
Glue Streaming Job: Configure your Glue job as a streaming job that reads from the message queue. This approach allows for parallel processing of events and can scale based on the input rate.
Regarding the use of Step Functions instead of Glue Streaming Jobs:
Pros of using Step Functions:
- More fine-grained control over the workflow
- Better error handling and retry mechanisms
- Easier to implement complex processing logic
Cons of using Step Functions:
- May introduce additional latency
- Could be more complex to set up for simple streaming scenarios
The choice between Glue Streaming Jobs and Step Functions depends on your specific use case, complexity of processing, and latency requirements.
For implementing this via CDK with Python and using openCypher:
-
Use the AWS CDK to define your infrastructure, including the Neptune cluster, Lambda functions, and any additional services like SQS or Kinesis.
-
Implement the Lambda function in Python to poll the Neptune Streams API using the
requestslibrary. -
Use the
GetSparqlStreamAPI operation for retrieving the change stream data if you're working with RDF data, orGetPropertygraphStreamfor property graph data. -
In your Lambda function, use the
neo4jPython driver to execute openCypher queries against Neptune if needed. -
Implement the downstream processing logic in either Glue jobs or Step Functions, depending on your chosen approach.
Remember to enable the Neptune Streams feature by setting the neptune_streams DB cluster parameter to 1, and ensure that your IAM roles have the necessary permissions to access the Neptune Streams API.
Sources
Capturing graph changes in real time using Neptune streams - Amazon Neptune
GetSparqlStream - Neptune Data API
Neptune streams dataplane API - Amazon Neptune
Choose the right change data capture strategy for your Amazon DynamoDB applications | AWS Database Blog
answered 2 years ago
Relevant content
asked 2 years ago
asked 4 years ago
asked a year ago

This seems to be a duplicate of https://repost.aws/questions/QURvEDTrHMSZCPl2oUwXkdQw/capturing-data-from-neptune-change-stream