Listing Storage Lens group tags
The following examples demonstrate how to list the Amazon resource tags associated with a Storage Lens group. You can list tags by using the Amazon S3 console, Amazon Command Line Interface (Amazon CLI), and Amazon SDK for Java.
To review the list of tags and tag values for a Storage Lens group
Sign in to the Amazon Web Services Management Console and open the Amazon S3 console at https://console.amazonaws.cn/s3/
. -
In the left navigation pane, choose Storage Lens groups.
-
Under Storage Lens groups, choose the Storage Lens group that you're interested in.
-
Scroll down to the Amazon resource tags section. All of the user-defined Amazon resource tags that are added to your Storage Lens group are listed along with their tag values.
The following Amazon CLI example command lists all the Storage Lens group tag
values for the Storage Lens group named
. To use
this example command, replace the marketing-department
with your own information.user input
placeholders
aws s3control list-tags-for-resource --account-id
111122223333
\ --resource-arn arn:aws-cn:s3:us-east-1
:111122223333
:storage-lens-group/marketing-department
\ --regionus-east-1
The following Amazon SDK for Java example lists the Storage Lens group tag values for
the Storage Lens group Amazon Resource Name (ARN) that you specify. To use this
example, replace the
with your own information.user input
placeholders
package aws.example.s3control; import com.amazonaws.AmazonServiceException; import com.amazonaws.SdkClientException; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.s3control.S3ControlClient; import software.amazon.awssdk.services.s3control.model.ListTagsForResourceRequest; import software.amazon.awssdk.services.s3control.model.ListTagsForResourceResponse; public class ListTagsForResource { public static void main(String[] args) { String resourceARN = "
Resource_ARN
"; String accountId = "111122223333
"; try { ListTagsForResourceRequest listTagsForResourceRequest = ListTagsForResourceRequest.builder() .resourceArn(resourceARN
) .accountId(accountId
) .build(); S3ControlClient s3ControlClient = S3ControlClient.builder() .region(Region.US_WEST_2
) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); ListTagsForResourceResponse response = s3ControlClient.listTagsForResource(listTagsForResourceRequest); System.out.println(response); } 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(); } } }