Getting started with data lineage
On supported releases, Amazon EMR and AWS Glue send lineage for jobs that write data. Use this page to confirm that your jobs can send lineage and to view your first lineage graph. For a hands-on walkthrough, see Test drive data lineage (tutorial).
Prerequisites
-
An AWS account in a Region that supports AWS Glue Data Catalog Lineage.
-
A job on a supported release: Amazon EMR emr-spark-8.2.0 or later, or AWS Glue 6.1 or later.
-
A database in the AWS Glue Data Catalog that the job writes to.
Step 1: Grant the lineage permission to your job roles
Each lineage event is signed with the credentials of the role that runs the job. That role
needs the glue:PostLineageEvent permission. If the role doesn't have it, the job
runs normally but doesn't send lineage.
Add it to custom roles, including roles that you created before emr-spark-8.2.0.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowLineageEmission", "Effect": "Allow", "Action": "glue:PostLineageEvent", "Resource": "*" } ] }
For which role sends events on each deployment option, see Permissions to send lineage.
Step 2: Connect private subnets to AWS Glue
Jobs in private subnets need a route to the AWS Glue endpoint. If your jobs already read tables from the Data Catalog in that subnet, the route usually exists.
-
Amazon EMR Serverless and Amazon EMR on EKS. Create an interface VPC endpoint for AWS Glue with the service name
com.amazonaws.region.glue. The endpoint's security group must allow inbound HTTPS (port 443) from your job subnets. If you attach an endpoint policy, it must allowglue:PostLineageEvent. -
Amazon EMR on EC2. Amazon EMR creates the endpoint for you when a cluster launches in a private subnet without one.
-
AWS Glue. AWS Glue jobs send lineage through the AWS Glue managed network path, so no change is needed.
Step 3: Run a job
Run a job or query that writes to a table in the Data Catalog, for example:
CREATE TABLE analytics.daily_sales AS SELECT order_date, sum(amount) AS total FROM sales_db.orders GROUP BY order_date;
Step 4: View the lineage graph
After lineage processing completes, open the output table in the AWS Glue console and choose the Lineage tab. The graph shows the job, its input tables, and the output table. For other options, see Viewing data lineage.
You can also read the node with the AWS CLI:
aws glue get-lineage-node \ --identifier arn:aws:glue:us-east-1:111122223333:table/analytics/daily_sales \ --region us-east-1
Step 5 (optional): Turn on the lineage system table
To query lineage events with SQL, turn on the lineage system table from Glue Data Catalog console settings. For details, see Turning on the lineage system table.