Updating snapshot retention optimizer - Amazon Glue
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Updating snapshot retention optimizer

You can update the existing configuration of an snapshot retention optimizer for a particular Apache Iceberg table using the Amazon Glue console, Amazon CLI, or the UpdateTableOptimizer API.

To update snapshot retention configuration
  1. Choose Data Catalog and choose Tables. From the tables list, choose the table you want to update the snapshot retention optimizer configuration.

  2. On the lower section of the Tables details page, choose Edit from the Snapshot retention history section.

  3. On the Edit optimization page, make the desired changes.

  4. Choose Save.

Amazon CLI

To update a snapshot retention optimizer using the Amazon CLI, you can use the following command:

aws glue_ret update-table-optimizer --catalog-id 123456789012 --database-name iceberg_db --table-name iceberg_table --table-optimizer-configuration '{"roleArn":"arn:aws:iam::123456789012:role/optimizer_role"","enabled":'true',"retentionConfiguration":{"icebergConfiguration":{"snapshotRetentionPeriodInDays":7,"numberOfSnapshotsToRetain":3,"cleanExpiredFiles":'true'}}}' \ --type retention --region Amazon Web Services Region

This command updates the retention configuration for the specified table in the given catalog, database, and Region. The key parameters are:

  • snapshotRetentionPeriodInDays –The number of days to retain snapshots before expiring them.

  • numberOfSnapshotsToRetain – The minimum number of snapshots to keep, even if they are older than the retention period.

  • cleanExpiredFiles – A boolean indicating whether to delete expired data files after expiring snapshots.

    When set to true, older snapshots are removed from table metadata, and their underlying files are deleted." If this parameter is set to false, older snapshots are removed from table metadata but their underlying files remain in the storage as orphan files.


To update a table optimizer, you can use the UpdateTableOptimizer API. This API allows you to update the configuration of an existing table optimizer for compaction, retention, or orphan file removal. The request parameters include:

  • catalogId (required): The ID of the catalog containing the table

  • databaseName (optional): The name of the database containing the table

  • tableName (optional): The name of the table

  • type (required): The type of table optimizer (compaction, retention, or orphan_file_deletion)

  • retentionConfiguration (required): The updated configuration for the table optimizer, including role ARN, enabled status, retention configuration, and orphan file removal configuration.