

# List Amazon S3 Storage Lens dashboards
<a name="storage_lens_list_dashboard"></a>

 

## Using the Amazon CLI
<a name="S3ListStorageLensConfigurationsCLI"></a>

**Example**  
The following example command lists the S3 Storage Lens dashboards in your Amazon Web Services account. To use these examples, replace the `{{user input placeholders}}` with your own information.  

```
aws s3control list-storage-lens-configurations --account-id={{222222222222}} --region={{us-east-1}} --next-token={{abcdefghij1234}}
```

**Example**  
The following example lists S3 Storage Lens configurations without a next token. To use these examples, replace the `{{user input placeholders}}` with your own information.  

```
aws s3control list-storage-lens-configurations --account-id={{222222222222}} --region={{us-east-1}}
```

## Using the Amazon SDK for Java
<a name="S3ListStorageLensConfigurationsJava"></a>

**Example – List S3 Storage Lens dashboard configurations**  
The following examples shows you how to list S3 Storage Lens configurations in SDK for Java. To use this example, replace the `{{user input placeholders}}` with your own information." to each example description.  

```
package aws.example.s3control;

import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.s3control.AWSS3Control;
import com.amazonaws.services.s3control.AWSS3ControlClient;
import com.amazonaws.services.s3control.model.ListStorageLensConfigurationEntry;
import com.amazonaws.services.s3control.model.ListStorageLensConfigurationsRequest;

import java.util.List;

import static com.amazonaws.regions.Regions.{{US_WEST_2}};

public class ListDashboard {

    public static void main(String[] args) {
        String sourceAccountId = "{{111122223333}}";
        String nextToken = "{{nextToken}}";

        try {
            AWSS3Control s3ControlClient = AWSS3ControlClient.builder()
                    .withCredentials(new ProfileCredentialsProvider())
                    .withRegion({{US_WEST_2}})
                    .build();

            final List<ListStorageLensConfigurationEntry> configurations =
                    s3ControlClient.listStorageLensConfigurations(new ListStorageLensConfigurationsRequest()
                            .withAccountId(sourceAccountId)
                            .withNextToken(nextToken)
                    ).getStorageLensConfigurationList();

            System.out.println(configurations.toString());
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but Amazon S3 couldn't process
            // it and returned an error response.
            e.printStackTrace();
        } catch (SdkClientException e) {
            // Amazon S3 couldn't be contacted for a response, or the client
            // couldn't parse the response from Amazon S3.
            e.printStackTrace();
        }
    }
}
```