Use Amazon EMR system tables
With system tables for Amazon EMR, usage data about your Spark jobs and interactive sessions on Amazon EMR 8.2 or later is automatically stored in tables that you can query for observability, cost analysis, and governance. System tables cover Amazon EMR on EC2, Amazon EMR on EKS, and Amazon EMR Serverless. Amazon EMR system tables are stored as fully managed Amazon S3 Tables, using Apache Iceberg format. You can query them with Athena, DuckDB, Amazon Redshift, or any other engine that is compatible with Apache Iceberg.
Before system tables, you had to build and operate custom pipelines, export logs and metrics, stitch them together, and load them into a separate store just to search, filter, or aggregate across jobs. Seeing which principal ran a workload, comparing performance across clusters or applications, or attributing compute usage to a team all took that same custom work.
With system tables, you don't build or maintain infrastructure. Amazon EMR manages the tables for you, including schema definition, partitioning, compaction, and snapshot maintenance. You control how long data is retained by configuring record expiration through Amazon S3 Tables.
With system tables, you can do the following.
-
Analyze usage without extract, transform, and load (ETL). Search, filter, aggregate, and join across your usage data directly, without building or maintaining custom pipelines.
-
Keep historical usage data. Retain usage data for as long as you need to review past activity and analyze long-term trends.
-
Monitor usage across Amazon EMR on EC2, Amazon EMR on EKS, and Amazon EMR Serverless in one place. See activity across your account and Region, identify high-usage workloads, and spot patterns.
-
Attribute usage by team, application, or time period. Break down usage to attribute it accurately.
-
Optimize job and session performance over time. Identify trends, regressions, and optimization opportunities across your workloads.
Topics
How Amazon EMR system tables work
You turn on system tables for each Amazon EMR service from the Amazon EMR console, the AWS CLI, or the SDK. You can cover Amazon EMR on EC2, Amazon EMR on EKS, and Amazon EMR Serverless. All of the Amazon EMR services that you turn on write into the same four tables. Amazon EMR writes usage data to Apache Iceberg tables stored in Amazon S3 Tables. Amazon EMR delivers data in batches at a fixed frequency.
System tables reside in your account, and Amazon EMR handles the following management tasks for you.
Creating the Amazon S3 Tables bucket, namespace, and tables in your account
Defining and evolving the table schemas
Writing data in Apache Iceberg format
Compacting data and maintaining snapshots, using the built-in Amazon S3 Tables compaction feature
Because Amazon EMR manages system tables, you can't insert, update, or delete individual rows. You control read access to the tables and manage data retention through Amazon S3 Tables record expiration.
Amazon EMR delivers only completed activity. A job that is still running is
not in the job_runs table until it ends. After Amazon EMR writes a
row to a system table, it doesn't update the row. The delivered data is
immutable.
There are two kinds of tables.
Run history tables (
job_runsandsessions) record one aggregated row for each job attempt or session that reaches a terminal state.Lifecycle tables (
job_lifecycleandsession_lifecycle) record one row for each state change, so you can follow a job or session through its transitions.
Storage location
Amazon EMR stores your system table data in an Amazon S3 Tables bucket named
aws-emr in your account and Region. Amazon EMR organizes the data
like this.
aws-emr/ # S3 Tables bucket (one per account per Region) +-- metadata/ # Namespace +-- job_runs/ # Table +-- job_lifecycle/ # Table +-- sessions/ # Table +-- session_lifecycle/ # Table
You can query a system table using its fully qualified name. The catalog name contains a slash and a hyphen, so you must enclose it in double quotation marks.
The following SQL query returns 10 rows from the job_runs table.
SELECT * FROM "s3tablescatalog/aws-emr"."metadata"."job_runs" LIMIT 10
Supported system tables
Amazon EMR provides the following system tables.
job_runs provides one aggregated row for each job attempt that reaches a terminal state.
job_lifecycle provides one row for each job state change.
sessions provides one aggregated row for each interactive session that reaches a terminal state.
session_lifecycle provides one row for each session state change.
Enabling system tables
Amazon EMR system tables are an opt-in feature that you manage for each Amazon EMR service at the account and Region level. When you enable system tables, Amazon EMR provisions an Amazon S3 Tables bucket and namespace in your account, and Amazon EMR publishes usage data for your current and future resources on the services that you turn on.
Using the console
To enable system tables
Open the Amazon EMR console
. In the left navigation pane, choose System tables.
Choose Configure.
Turn on system tables in the dialog.
Choose the Amazon EMR services you want to cover, from Amazon EMR on EC2, Amazon EMR on EKS, and Amazon EMR Serverless.
(Optional) Expand Data encryption and select an AWS Key Management Service (AWS KMS) key to encrypt the usage data written to Amazon S3 Tables. If you don't select a key, Amazon EMR uses Amazon S3 managed keys (SSE-S3). The key applies to every table and takes effect when Amazon EMR first writes data. For more information, see Configuring encryption.
Choose Save.
After you save, Amazon EMR begins writing usage data to Amazon S3 Tables. The system tables page shows a summary of the tables, their coverage for each Amazon EMR service, and the AWS KMS key, if configured.
To disable system tables, choose Configure, turn off the Amazon EMR services you no longer want to cover, and confirm in the dialog. Disabling stops new data from being written. The tables remain, and existing data stays queryable. To permanently delete a system table, also drop the table through Amazon S3 Tables.
Using the AWS CLI
You manage system tables with the
PutSystemTablesConfiguration and
GetSystemTablesConfiguration control-plane operations. To
enable or disable system tables for an Amazon EMR service, complete the
following steps.
-
To enable system tables for an Amazon EMR service, set its mode to
ALL. The following AWS CLI command example enables system tables for an Amazon EMR service.PROMPT> aws emr put-system-tables-configuration \ --platforms Platform=EMR_EC2,SystemTables={Mode=ALL} -
(Optional) To use a customer managed AWS KMS key for encryption, specify the key ARN. The following AWS CLI command example enables system tables with a customer managed AWS KMS key.
PROMPT> aws emr put-system-tables-configuration \ --platforms Platform=EMR_EC2,SystemTables={Mode=ALL},\ EncryptionConfiguration={KmsKeyArn=arn:aws:kms:us-east-1:111122223333:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111}In the preceding command, replace the following value.
KmsKeyArnis the ARN of your customer managed AWS KMS key.
-
To check the current configuration, use the
GetSystemTablesConfigurationoperation. The following AWS CLI command example checks the current configuration.PROMPT> aws emr get-system-tables-configuration -
To disable system tables for an Amazon EMR service, set its mode to
NONE. The following AWS CLI command example disables system tables for an Amazon EMR service.PROMPT> aws emr put-system-tables-configuration \ --platforms Platform=EMR_EC2,SystemTables={Mode=NONE}
Registering with AWS Glue Data Catalog
Before you can query system table data, the Amazon S3 Tables bucket must
be integrated with AWS Glue
For more information, see Integrating Amazon S3 Tables with AWS Glue Data Catalog in the AWS Glue Developer Guide.
IAM permissions
System tables use two kinds of permissions. Administrators who
enable, update, and disable system tables call the control-plane operations
elasticmapreduce:PutSystemTablesConfiguration and
elasticmapreduce:GetSystemTablesConfiguration, and also
need permissions to create the Amazon S3 Tables bucket and, if you use a
customer managed key, to validate the key. Users who only query system
tables need read permissions on the Amazon S3 Tables bucket and the
AWS Glue Data Catalog. Grant these two kinds of permissions separately, following
least privilege.
Permissions to manage system tables
When you enable system tables, Amazon EMR uses your credentials to
create the aws-emr Amazon S3 Tables bucket and attach its bucket
policy, so you need s3tables:CreateTableBucket and
s3tables:PutTableBucketPolicy. If you encrypt with a customer
managed AWS Key Management Service (AWS KMS) key, you also need kms:DescribeKey on that
key. Omit the ValidateEncryptionKey statement if you use the
default Amazon S3 managed keys (SSE-S3).
PutSystemTablesConfiguration and
GetSystemTablesConfiguration don't support resource-level
permissions, so their resource must be *.
The following example policy grants these permissions.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "ManageSystemTablesConfiguration", "Effect": "Allow", "Action": [ "elasticmapreduce:PutSystemTablesConfiguration", "elasticmapreduce:GetSystemTablesConfiguration" ], "Resource": "*" }, { "Sid": "CreateSystemTablesBucket", "Effect": "Allow", "Action": [ "s3tables:CreateTableBucket", "s3tables:PutTableBucketPolicy" ], "Resource": "arn:aws:s3tables:eusc-de-east-1:111122223333:bucket/aws-emr" }, { "Sid": "ValidateEncryptionKey", "Effect": "Allow", "Action": "kms:DescribeKey", "Resource": "arn:aws:kms:eusc-de-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" } ] }
Replace with the ID of your own key.1234abcd-12ab-34cd-56ef-1234567890ab
To register the Amazon S3 Tables bucket with AWS Glue Data Catalog, you also need
glue:CreateCatalog and
glue:PassConnection. For more information, see Registering with AWS Glue Data Catalog.
Permissions to query system tables
This policy grants read access to the system tables without any
permission to change the configuration or the data. The principal also
needs the permissions of the query engine it uses, for example Amazon
Athena or Amazon Redshift. If system tables are encrypted with a customer
managed key, the principal needs kms:Decrypt and
kms:DescribeKey on that key. Without them, the query fails
with a table-not-found error rather than an access denied error. Omit the
DecryptSystemTables statement if you use the default SSE-S3
encryption.
The following example policy grants these permissions.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "ReadSystemTablesCatalog", "Effect": "Allow", "Action": [ "glue:GetCatalog", "glue:GetDatabase", "glue:GetDatabases", "glue:GetTable", "glue:GetTables", "glue:GetPartitions" ], "Resource": [ "arn:aws:glue:eusc-de-east-1:111122223333:catalog", "arn:aws:glue:eusc-de-east-1:111122223333:catalog/s3tablescatalog", "arn:aws:glue:eusc-de-east-1:111122223333:catalog/s3tablescatalog/*", "arn:aws:glue:eusc-de-east-1:111122223333:database/*", "arn:aws:glue:eusc-de-east-1:111122223333:table/*" ] }, { "Sid": "ReadSystemTablesData", "Effect": "Allow", "Action": [ "s3tables:GetTableBucket", "s3tables:ListNamespaces", "s3tables:GetNamespace", "s3tables:ListTables", "s3tables:GetTable", "s3tables:GetTableData", "s3tables:GetTableMetadataLocation" ], "Resource": [ "arn:aws:s3tables:eusc-de-east-1:111122223333:bucket/aws-emr", "arn:aws:s3tables:eusc-de-east-1:111122223333:bucket/aws-emr/*" ] }, { "Sid": "LakeFormationDataAccess", "Effect": "Allow", "Action": "lakeformation:GetDataAccess", "Resource": "*" }, { "Sid": "DecryptSystemTables", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:DescribeKey" ], "Resource": "arn:aws:kms:eusc-de-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" } ] }
lakeformation:GetDataAccess doesn't support
resource-level permissions, so its resource must be *.
Replace with the ID of your own key.1234abcd-12ab-34cd-56ef-1234567890ab
Configuring encryption
By default, data in system tables is encrypted with Amazon S3 managed keys (SSE-S3). To use a customer managed AWS KMS key, specify the full key ARN when you enable system tables. One key applies to all of the tables. Only customer managed keys are supported.
You can't change the AWS KMS key after Amazon EMR creates the tables. To change the key after the tables exist, turn off system tables, drop the tables through Amazon S3 Tables (which permanently removes the data), and then turn system tables on again with the new key.
Key policy for a customer managed key
By default, data is encrypted with Amazon S3 managed keys (SSE-S3). To
use a customer managed AWS KMS key, the key policy must grant the Amazon EMR
system tables service principal
(systemtables.elasticmapreduce.amazonaws.com) and the Amazon S3
Tables maintenance service principal
(maintenance.s3tables.amazonaws.com) access to the key. Only
customer managed keys are supported. A key created in the AWS KMS console
doesn't include these statements by default. Add the following statements,
replacing the example account, Region, and key ID with your values.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowEmrSystemTablesDescribeKey", "Effect": "Allow", "Principal": { "Service": "systemtables.elasticmapreduce.amazonaws.com" }, "Action": "kms:DescribeKey", "Resource": "arn:aws:kms:eusc-de-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", "Condition": { "StringEquals": { "aws:SourceAccount": "111122223333" } } }, { "Sid": "AllowEmrSystemTablesEncryptDecrypt", "Effect": "Allow", "Principal": { "Service": "systemtables.elasticmapreduce.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "arn:aws:kms:eusc-de-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", "Condition": { "StringEquals": { "aws:SourceAccount": "111122223333" }, "StringLike": { "kms:EncryptionContext:aws:s3:arn": "arn:aws:s3tables:eusc-de-east-1:111122223333:bucket/aws-emr/table/*", "kms:ViaService": "s3.eusc-de-east-1.amazonaws.com" } } }, { "Sid": "AllowS3TablesMaintenanceEncryptDecrypt", "Effect": "Allow", "Principal": { "Service": "maintenance.s3tables.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "arn:aws:kms:eusc-de-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", "Condition": { "StringEquals": { "aws:SourceAccount": "111122223333" }, "StringLike": { "kms:EncryptionContext:aws:s3:arn": "arn:aws:s3tables:eusc-de-east-1:111122223333:bucket/aws-emr/*" } } } ] }
You must include the kms:EncryptionContext:aws:s3:arn condition.
Without it, Amazon EMR can't call kms:GenerateDataKey to
write data to the tables.
Security
System tables follow the AWS shared responsibility model. For permissions, see IAM permissions.
Compliance, resilience, and infrastructure security. For information about these topics, see Security in Amazon EMR.
Write access. The
aws-emrbucket is an AWS managed table bucket. Only thesystemtables.elasticmapreduce.amazonaws.comservice principal writes to it. Your account can read the tables but can't change rows.Confused deputy prevention. Amazon EMR sends your account as the source account. The
aws:SourceAccountcondition in the key policy limits use of the key to your account. For the key policy, see Key policy for a customer managed key.Private connectivity. You can call
PutSystemTablesConfigurationandGetSystemTablesConfigurationthrough the Amazon EMR interface VPC endpoint. For more information, see Connect to Amazon EMR using an interface VPC endpoint.
Data governance
You govern access to system table data. Amazon EMR doesn't apply read permissions on your behalf and doesn't mask data.
Cataloging and discovery. The AWS Glue Data Catalog integration provides a central place to discover system tables and apply fine-grained permissions.
Access control. After you register the Amazon S3 Tables bucket with AWS Glue Data Catalog, you can govern read access using AWS Identity and Access Management (IAM) or AWS Lake Formation. You can apply table-level, column-level, or row-level permissions.
Sensitive data. You might determine that your usage data contains sensitive information. For example, submitted configuration or the submitter identity might be sensitive in your environment. Consider restricting access to sensitive columns using column-level permissions in Lake Formation, or limit access to specific principals.
Delivery and lifecycle behavior
System tables have the following delivery and lifecycle behavior.
Delivery. Amazon EMR delivers data within minutes of a job or session reaching the state that is recorded.
Deduplication. Amazon EMR delivers records to the tables. If you need exactly one row for each job attempt or session, deduplicate on the row key and keep the row with the latest
ingest_time.Enable, disable, re-enable. Disabling an Amazon EMR service stops new data from being written for it shortly after. Re-enabling resumes delivery going forward. The gap period is not backfilled.
Disabling. When you disable a service, the tables and all previously delivered data are retained and remain queryable.
Dropping the table. You can drop a table through Amazon S3 Tables. This permanently removes all previously delivered data in that table. For more information, see Deleting S3 tables in the Amazon S3 User Guide.
Best practices
Restrict access to sensitive data. Some columns can contain sensitive information, such as
submitter_arn,execution_role_arn, the configuration JSON columns,state_reason_message, ands3_log_uri. Use IAM or Lake Formation to restrict read access based on your governance requirements. For more information, see Data governance.Choose encryption before you enable. If you want to use a customer managed AWS KMS key, specify it when you first enable the feature. The key can't be changed after the tables are created. For more information, see Configuring encryption.
Set retention through Amazon S3 Tables. Amazon EMR doesn't set a default retention period. Data is kept until you configure expiration. Use the Amazon S3 Tables record expiration feature to set retention based on your compliance and cost requirements. For more information, see Configuring record expiration for S3 table buckets in the Amazon S3 User Guide.
Use partition filters for better query performance. Amazon EMR system tables are partitioned. To see the partition columns for a table, run a
DESCRIBEstatement, then include those columns in your query filters to benefit from partition pruning and reduce the data scanned.
Billing
Delivery is free. Amazon EMR doesn't charge for writing usage data to Amazon S3 Tables.
Amazon S3 Tables storage. You pay standard Amazon S3 Tables storage and maintenance charges for the retained data. For more information, see Amazon S3 Tables pricing
. Query costs. You pay standard query charges for the engine you use. Athena, DuckDB, Amazon Redshift, and other engines follow their own pricing.
The vcpu_seconds and memory_gb_seconds
columns report allocated resource usage, not billed cost.
Considerations and limitations
System tables are available for Spark workloads on Amazon EMR 8.2 or later.
Amazon EMR system tables are supported within a single AWS account and a single AWS Region. Cross-account and cross-Region consolidation is not supported.
Delivered data is immutable. You can't insert, update, or delete individual rows.
No default retention is set. You must configure record expiration through Amazon S3 Tables to manage storage costs.
Querying system tables requires integrating the Amazon S3 Tables bucket with AWS Glue Data Catalog.
One AWS KMS key covers all of the tables. You can't set a different key for each table.
Jobs submitted directly to the underlying compute outside the Amazon EMR APIs might not be recorded.