View a markdown version of this page

Use AWS Glue system tables - AWS Glue

Use AWS Glue system tables

With system tables for AWS Glue, usage data about your AWS Glue jobs and interactive sessions running AWS Glue version 6.1 or later is automatically stored in tables that you can query for observability, cost analysis, auditing, and governance.

AWS Glue stores system tables as fully managed Amazon S3 Tables, in Apache Iceberg format. You can query them with AWS Glue, Amazon Athena, DuckDB, Amazon Redshift, or any other engine that is compatible with Apache Iceberg.

When you enable this feature, you choose which tables to turn on. The tables cover all current and future AWS Glue jobs and interactive sessions in your account and AWS Region. AWS Glue manages the tables for you, including schema definition and partitioning. Amazon S3 Tables automatically compacts the data and manages snapshots.

System tables support the following use cases:

  • You can analyze usage without extract, transform, and load (ETL). You can search, filter, aggregate, and join across your usage data directly, without building or maintaining custom pipelines.

  • You can meet compliance and audit requirements by keeping usage data for as long as you need, whether that is months or years.

  • You can monitor your usage in one place. You can see activity across all jobs and sessions in your account and Region, identify high-usage jobs, and spot patterns.

  • You can attribute usage by team or project by breaking down usage by job, team, role, or time period.

  • You can optimize workload performance by identifying trends, regressions, and optimization opportunities across your workloads over time.

How it works

After you enable system tables through the AWS Glue console, the AWS Command Line Interface (AWS CLI), or the AWS SDKs, AWS Glue writes usage data from your jobs and interactive sessions to Apache Iceberg tables stored in S3 Tables. AWS Glue delivers only completed activity, as one row for each job run or session at its final state.

AWS Glue delivers data within minutes after a job run or session reaches its final state.

System tables reside in your account, but AWS Glue manages them. AWS Glue performs the following tasks:

  • AWS Glue creates the S3 Tables bucket, namespace, and tables in your account.

  • AWS Glue defines and evolves the table schemas.

  • AWS Glue writes data in Apache Iceberg format.

Amazon S3 Tables automatically compacts the data and manages snapshots.

The aws-glue bucket is an AWS managed table bucket, so you can't insert, update, or delete individual rows. For more information about AWS managed table buckets, see AWS managed table buckets in the Amazon S3 User Guide. You control read access to the tables. AWS Glue doesn't apply record expiration to system table data, so the data is kept until you drop the table.

AWS Glue does not write in-flight activity. For the status of running jobs and sessions, use the AWS Glue console or the GetJobRun and GetSession API operations. After AWS Glue writes a row to a system table, AWS Glue does not update it.

Storage location

AWS Glue stores your system table data in an S3 Tables bucket named aws-glue in your account and Region. The following shows the bucket, namespace, and tables that AWS Glue creates:

aws-glue/ # S3 Tables bucket (one per account and Region) +-- metadata/ # Namespace +-- job_runs/ # Table +-- sessions/ # Table

The following SQL query selects from a system table by its fully qualified name:

SELECT * FROM "s3tablescatalog/aws-glue"."metadata"."job_runs" LIMIT 100

Supported system tables

System tables capture usage data about your AWS Glue job runs and interactive sessions, with one table for each resource type. Choose which tables to enable based on whether you need job run data, session data, or both. The following system tables are available:

Enabling system tables

AWS Glue system tables are an opt-in feature that you manage at the account and Region level. When you turn on system tables, both the job_runs and sessions tables are turned on by default, and you can select which tables you want. When you enable a system table, AWS Glue provisions an S3 Tables bucket and namespace in your account, and usage data is published for all your current and future jobs and sessions.

Using the console

To enable system tables

  1. Open the AWS Glue console.

  2. In the navigation pane, choose System tables.

  3. Choose Configure.

  4. Turn on system tables.

  5. Under Table scope, select the tables that you want to turn on. Both job_runs and sessions are selected by default. At least one table must stay on.

  6. (Optional) Under Data encryption, choose an AWS Key Management Service (AWS KMS) key to encrypt the usage data written to S3 Tables. By default, the key you choose applies to all system tables, but you can choose a different key for each table. If you do not choose a key, AWS Glue uses Amazon S3 managed keys (SSE-S3). For instructions on configuring encryption, see Configuring encryption.

  7. Choose Save.

After you save, AWS Glue begins writing usage data to S3 Tables. System tables begin publishing usage data within minutes after you save. The system tables page shows a summary of the tables you enabled, their scope and coverage, and the AWS KMS key (if configured).

To disable system tables, choose Configure, turn off the tables you want to turn off, and choose Save. Confirm the change in the dialog box. Disabling stops new data from being written to those tables. The tables remain, and existing data stays queryable. To permanently delete a system table, also drop the table through the S3 Tables API.

Using the AWS CLI

You manage system tables using the following API operations.

API

Description

UpdateSystemTable

Enable or disable a system table for your account. When you enable a table for the first time, AWS Glue provisions the S3 Tables bucket and starts publishing.

GetSystemTable

Return the current configuration and status for a system table.

The following AWS CLI command enables the job_runs system table:

aws glue update-system-table \ --system-table-type GLUE_JOB_RUNS \ --action ENABLE

The following AWS CLI command enables the sessions table:

aws glue update-system-table \ --system-table-type GLUE_SESSIONS \ --action ENABLE

The following AWS CLI command enables the job_runs table with a customer managed AWS KMS key. Before you run it, replace the placeholders with your own values:

  • REGION is the AWS Region that contains the AWS KMS key.

  • ACCOUNT is your AWS account ID.

  • KEY_ID is the identifier of your AWS KMS key.

aws glue update-system-table \ --system-table-type GLUE_JOB_RUNS \ --action ENABLE \ --encryption-configuration EncryptionType=SSE_KMS,KmsKeyArn=arn:aws:kms:REGION:ACCOUNT:key/KEY_ID

The following AWS CLI command checks the current configuration:

aws glue get-system-table \ --system-table-type GLUE_JOB_RUNS

After you enable a table, call GetSystemTable until Status is ACTIVE or FAILED. You can query the table when it's ACTIVE. GetSystemTable can return the following Status values:

ENABLED

The table is enabled, but provisioning has not started yet.

IN_PROGRESS

AWS Glue is provisioning the table.

ACTIVE

The table is provisioned and AWS Glue is publishing data to it. The TableArn is populated.

FAILED

Provisioning failed. See the StatusDetails field for the reason.

INACTIVE

The table is disabled and no longer receiving data.

AWS Glue can add Status values over time.

The following AWS CLI command disables a system table:

aws glue update-system-table \ --system-table-type GLUE_JOB_RUNS \ --action DISABLE

Registering with AWS Glue Data Catalog

Before you can query system table data, the S3 Tables bucket must be integrated with AWS Glue Data Catalog. This is a one-time step per account and Region. If you have already integrated S3 Tables with AWS Glue Data Catalog, no additional action is required.

For instructions on integrating Amazon S3 Tables with AWS Glue Data Catalog, see Integrating with Amazon S3 Tables.

IAM permissions

System tables use two kinds of permissions. Administrators who enable, disable, and view system tables need the permissions in Permissions to manage system tables. Users who only query system tables need the permissions in Permissions to query system tables. Both example policies follow the principle of least privilege. Replace <REGION>, <ACCOUNT>, and the other placeholders with your own values.

Permissions to manage system tables

The following policy allows a principal to enable, disable, and view system tables. When you enable system tables, AWS Glue uses your credentials to create the aws-glue S3 Tables bucket, so you need s3tables:CreateTableBucket. The AWS managed bucket type grants registered service principals access, so you do not need s3tables:PutTableBucketPolicy. You can't scope glue:UpdateSystemTable and glue:GetSystemTable to a specific resource, so their resource is *.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ManageSystemTables", "Effect": "Allow", "Action": [ "glue:UpdateSystemTable", "glue:GetSystemTable" ], "Resource": "*" }, { "Sid": "CreateSystemTablesBucket", "Effect": "Allow", "Action": "s3tables:CreateTableBucket", "Resource": "arn:aws:s3tables:<REGION>:<ACCOUNT>:bucket/aws-glue" }, { "Sid": "ValidateEncryptionKey", "Effect": "Allow", "Action": "kms:DescribeKey", "Resource": "arn:aws:kms:<REGION>:<ACCOUNT>:key/<KEY_ID>" } ] }

To register the 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

The following policy allows a principal to query system tables without granting any permission to change the configuration or the table data. The example uses Amazon Athena as the query engine. The principal also needs permissions to write query results to the query result location. If system tables are encrypted with a customer managed key, the principal also needs kms:Decrypt and kms:DescribeKey on that key.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "RunQueries", "Effect": "Allow", "Action": [ "athena:StartQueryExecution", "athena:GetQueryExecution", "athena:GetQueryResults", "athena:StopQueryExecution" ], "Resource": "arn:aws:athena:<REGION>:<ACCOUNT>:workgroup/<WORKGROUP>" }, { "Sid": "ReadSystemTablesCatalog", "Effect": "Allow", "Action": [ "glue:GetCatalog", "glue:GetDatabase", "glue:GetDatabases", "glue:GetTable", "glue:GetTables", "glue:GetPartitions" ], "Resource": [ "arn:aws:glue:<REGION>:<ACCOUNT>:catalog", "arn:aws:glue:<REGION>:<ACCOUNT>:catalog/s3tablescatalog", "arn:aws:glue:<REGION>:<ACCOUNT>:catalog/s3tablescatalog/*", "arn:aws:glue:<REGION>:<ACCOUNT>:database/*", "arn:aws:glue:<REGION>:<ACCOUNT>:table/*" ] }, { "Sid": "ReadSystemTablesData", "Effect": "Allow", "Action": [ "s3tables:GetTableBucket", "s3tables:ListNamespaces", "s3tables:GetNamespace", "s3tables:ListTables", "s3tables:GetTable", "s3tables:GetTableData", "s3tables:GetTableMetadataLocation" ], "Resource": [ "arn:aws:s3tables:<REGION>:<ACCOUNT>:bucket/aws-glue", "arn:aws:s3tables:<REGION>:<ACCOUNT>:bucket/aws-glue/*" ] }, { "Sid": "LakeFormationDataAccess", "Effect": "Allow", "Action": "lakeformation:GetDataAccess", "Resource": "*" }, { "Sid": "DecryptSystemTables", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:DescribeKey" ], "Resource": "arn:aws:kms:<REGION>:<ACCOUNT>:key/<KEY_ID>" } ] }

You can't scope lakeformation:GetDataAccess to a specific resource, so its resource must be *.

Configuring encryption

By default, AWS Glue encrypts system table data with Amazon S3 managed keys (SSE-S3). To use a customer managed AWS Key Management Service (AWS KMS) key, specify the encryption configuration when you enable the table.

The AWS Glue and Amazon S3 Tables endpoints use TLS to encrypt data in transit to and from system tables.

The AWS KMS key is fixed after AWS Glue creates the system table. To change the key after the table exists, turn off the table, drop the table through the S3 Tables API (which permanently removes the data), and then enable the table again with the new key.

If you use a customer managed key, the key policy must grant both the AWS Glue system tables service principal (systemtables.glue.amazonaws.com) and the S3 Tables maintenance service principal (maintenance.s3tables.amazonaws.com) access to the key. Add the following statements to your key policy, replacing <REGION>, <ACCOUNT>, and <KEY_ID> with your values.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowGlueSystemTablesDescribeKey", "Effect": "Allow", "Principal": { "Service": "systemtables.glue.amazonaws.com" }, "Action": "kms:DescribeKey", "Resource": "arn:aws:kms:<REGION>:<ACCOUNT>:key/<KEY_ID>", "Condition": { "StringEquals": { "aws:SourceAccount": "<ACCOUNT>" } } }, { "Sid": "AllowGlueSystemTablesEncryptDecrypt", "Effect": "Allow", "Principal": { "Service": "systemtables.glue.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "arn:aws:kms:<REGION>:<ACCOUNT>:key/<KEY_ID>", "Condition": { "StringEquals": { "aws:SourceAccount": "<ACCOUNT>" }, "StringLike": { "kms:EncryptionContext:aws:s3:arn": "arn:aws:s3tables:<REGION>:<ACCOUNT>:bucket/aws-glue/table/*", "kms:ViaService": "s3.<REGION>.amazonaws.com" } } }, { "Sid": "AllowS3TablesMaintenanceEncryptDecrypt", "Effect": "Allow", "Principal": { "Service": "maintenance.s3tables.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "arn:aws:kms:<REGION>:<ACCOUNT>:key/<KEY_ID>", "Condition": { "StringEquals": { "aws:SourceAccount": "<ACCOUNT>" }, "StringLike": { "kms:EncryptionContext:aws:s3:arn": "arn:aws:s3tables:<REGION>:<ACCOUNT>:bucket/aws-glue/*" } } } ] }

Data governance

Governing system table data is a shared responsibility. AWS Glue does not apply read permissions on your behalf or mask data, so you control who can read the tables.

  • Access control. After you register the S3 Tables bucket with AWS Glue Data Catalog, govern read access with IAM or AWS Lake Formation. You can apply table-level, column-level, or row-level permissions.

  • Sensitive data. Your usage data might contain sensitive information. The most sensitive column is on_behalf_of_subject, which holds the end user's identifier (for example, an email address) in plain text under trusted identity propagation. In addition, job_config_json and session_config_json have secrets redacted but can still hold sensitive arguments, and columns such as submitter_arn and error_message can identify principals. Restrict access to sensitive columns with Lake Formation, or limit access to specific principals.

Delivery and lifecycle behavior

  • Delivery frequency. AWS Glue delivers data within minutes after a job run or session reaches its final state.

  • Enabling, disabling, and re-enabling. While a system table is disabled, AWS Glue does not capture data for that period. When you enable the table again, AWS Glue resumes delivery going forward but does not backfill the gap.

  • Disabling. When you disable a table, AWS Glue stops publishing new data. The table and all previously delivered data remain queryable.

  • Dropping the table. You can drop the table through the S3 Tables API, which permanently removes all delivered data. For more information, see Deleting S3 tables in the Amazon S3 User Guide. To resume writing data, enable the table again.

Best practices

  • Restrict access to sensitive data. System tables can contain sensitive information, such as job arguments or error messages. Use IAM or Lake Formation to restrict read access. For more information, see Data governance.

  • Configure encryption before the table is created. To use a customer managed AWS KMS key, specify it when you first enable the table. You cannot change the key after AWS Glue creates the table. For more information, see Configuring encryption.

  • Understand data retention. AWS Glue retains system table data and does not apply record expiration to system tables. The data is retained until you drop the table. For more information, see Delivery and lifecycle behavior.

  • Use partition filters. AWS Glue system tables are partitioned. Include a filter on the partition column in your queries to reduce the data scanned. To find a table's partition columns, use the DESCRIBE statement.

Billing

  • Delivery is free. AWS Glue does not charge for writing usage data to S3 Tables.

  • S3 Tables storage. You pay standard 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. Other engines, such as DuckDB and Amazon Redshift, follow their own pricing.

Considerations and limitations

Review the following constraints before you enable system tables:

  • Only jobs and interactive sessions that run AWS Glue version 6.1 or later produce rows.

  • AWS Glue system tables are supported within a single AWS account and a single AWS Region. Cross-account and cross-Region consolidation is not supported.

  • Job runs that are not started through StartJobRun do not have a submitter_arn value.

  • A job run or session can have more than one row. To get one row for each job run, keep the row with the latest ingest_time for each combination of account_id, region_name, job_name, and execution_id. For sessions, use account_id, region_name, and session_id.