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).
If you're new to archival storage in Amazon Simple Storage Service (Amazon S3), we recommend that you start by
learning more about the S3 Glacier storage classes in Amazon S3, S3 Glacier Instant Retrieval, S3 Glacier Flexible Retrieval, and S3 Glacier Deep Archive. For more information, see S3 Glacier storage classes and
Storage classes for archiving objects in the Amazon S3 User
Guide.
The following code examples show how to use ListTagsForVault
.
- .NET
-
- Amazon SDK for .NET
-
/// <summary>
/// List tags for an Amazon S3 Glacier vault.
/// </summary>
/// <param name="vaultName">The name of the vault to list tags for.</param>
/// <returns>A dictionary listing the tags attached to each object in the
/// vault and its tags.</returns>
public async Task<Dictionary<string, string>> ListTagsForVaultAsync(string vaultName)
{
var request = new ListTagsForVaultRequest
{
// Using a hyphen "-" for the Account Id will
// cause the SDK to use the Account Id associated
// with the default user.
AccountId = "-",
VaultName = vaultName,
};
var response = await _glacierService.ListTagsForVaultAsync(request);
return response.Tags;
}
- CLI
-
- Amazon CLI
-
The following command lists the tags applied to a vault named my-vault
:
aws glacier list-tags-for-vault --account-id - --vault-name my-vault
Output:
{
"Tags": {
"date": "july2015",
"id": "1234"
}
}
Amazon Glacier requires an account ID argument when performing operations, but you can use a hyphen to specify the in-use account.
For a complete list of Amazon SDK developer guides and code examples, see
Using S3 Glacier with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.