

# Update an Amazon S3 Storage Lens for Tables dashboard

To change what an existing Amazon S3 Storage Lens for Tables configuration collects – for example, to opt in to an advanced tier, change the scope, or turn on an export – you update the configuration. You can update a configuration by using the Amazon S3 console, the AWS CLI, or the API.

## Using the S3 console
<a name="s3-tables-storage-lens-console-editing"></a>

Use the following steps to edit an Amazon S3 Storage Lens for Tables dashboard on the Amazon S3 console.

**To edit an Amazon S3 Storage Lens for Tables dashboard**

1. Sign in to the AWS Management Console and open the Amazon S3 console at [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/).

1. In the left navigation pane, choose **Storage Lens**, and then choose the **Table buckets** tab.

1. In the list of dashboards, choose the dashboard that you want to edit, and then choose **Edit**.

1. Review the configuration step by step and make your changes. To go to a specific step, choose it in the wizard navigation. For a description of each step, see [Create an Amazon S3 Storage Lens for Tables dashboard](s3-tables-storage-lens-creating.md).
**Note**  
You can't change the dashboard name or the home Region.

1. On the **Review and create** step, review your settings. To make changes to a section, choose **Edit** for that section.

1. After you review and confirm your changes, choose **Submit** to update your dashboard.

## Using the AWS CLI
<a name="s3-tables-storage-lens-cli-editing"></a>

You update a configuration by using the `put-storage-lens-configuration` command, which calls the `PutStorageLensConfiguration` operation. Supplying the identifier of an existing configuration replaces that configuration with the body that you provide, so include the complete configuration, not only the fields that you want to change. To get the current configuration so that you can edit it and write it back, use `get-storage-lens-configuration`. For a sample configuration body and the fields it supports, see [Helper files for using Amazon S3 Storage Lens for Tables](s3-tables-storage-lens-helper-files.md).

**Example**  
The following example command updates an Amazon S3 Storage Lens for Tables configuration. To use this example, replace the `{{user input placeholders}}` with your own information.  

```
aws s3tables put-storage-lens-configuration --storage-lens-id={{your-configuration-id}} --storage-lens-configuration={{file://./config.json}}
```

## Using the AWS SDK for Java
<a name="s3-tables-storage-lens-java-editing"></a>

The following example updates an Amazon S3 Storage Lens for Tables configuration in SDK for Java. Because the operation replaces the existing configuration, build the complete `StorageLensConfiguration`, not only the fields that you want to change. To avoid dropping settings, read the current configuration with `getStorageLensConfiguration`, modify it, and write it back. To use this example, replace the `{{user input placeholders}}` with your own information.

**Example – Update an Amazon S3 Storage Lens for Tables configuration**  

```Java
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3tables.S3TablesClient;
import software.amazon.awssdk.services.s3tables.model.GetStorageLensConfigurationRequest;
import software.amazon.awssdk.services.s3tables.model.PutStorageLensConfigurationRequest;
import software.amazon.awssdk.services.s3tables.model.StorageLensConfiguration;
import software.amazon.awssdk.services.s3tables.model.S3TablesException;

public class UpdateStorageLensConfiguration {

    public static void main(String[] args) {
        String storageLensId = "{{your-configuration-id}}";

        try (S3TablesClient s3TablesClient = S3TablesClient.builder()
                .region(Region.{{US_EAST_1}})
                .build()) {

            // Read the current configuration so that the update preserves existing settings.
            StorageLensConfiguration current = s3TablesClient.getStorageLensConfiguration(
                    GetStorageLensConfigurationRequest.builder()
                            .storageLensId(storageLensId)
                            .build())
                    .storageLensConfiguration();

            // Modify a copy of the current configuration. This example opts in to the advanced
            // tier metric categories while keeping everything else.
            StorageLensConfiguration updated = current.toBuilder()
                    .advancedMetricsCategoriesWithStrings("StorageMetrics", "ActivityMetrics", "MaintenanceMetrics")
                    .build();

            s3TablesClient.putStorageLensConfiguration(PutStorageLensConfigurationRequest.builder()
                    .storageLensId(storageLensId)
                    .storageLensConfiguration(updated)
                    .build());
        } catch (S3TablesException e) {
            System.err.println(e.awsErrorDetails().errorMessage());
        }
    }
}
```