Use AddTagsToVault with an Amazon SDK or CLI - Amazon S3 Glacier
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).

This page is only for existing customers of the S3 Glacier service using Vaults and the original REST API from 2012.

If you're looking for archival storage solutions we suggest using the S3 Glacier storage classes in Amazon S3, S3 Glacier Instant Retrieval, S3 Glacier Flexible Retrieval, and S3 Glacier Deep Archive. To learn more about these storage options, see S3 Glacier storage classes and Long-term data storage using S3 Glacier storage classes in the Amazon S3 User Guide. These storage classes use the Amazon S3 API, are available in all regions, and can be managed within the Amazon S3 console. They offer features like Storage Cost Analysis, Storage Lens, advanced optional encryption features, and more.

Use AddTagsToVault with an Amazon SDK or CLI

The following code examples show how to use AddTagsToVault.

Amazon SDK for .NET

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

/// <summary> /// Add tags to the items in an Amazon S3 Glacier vault. /// </summary> /// <param name="vaultName">The name of the vault to add tags to.</param> /// <param name="key">The name of the object to tag.</param> /// <param name="value">The tag value to add.</param> /// <returns>A Boolean value indicating the success of the action.</returns> public async Task<bool> AddTagsToVaultAsync(string vaultName, string key, string value) { var request = new AddTagsToVaultRequest { Tags = new Dictionary<string, string> { { key, value }, }, AccountId = "-", VaultName = vaultName, }; var response = await _glacierService.AddTagsToVaultAsync(request); return response.HttpStatusCode == HttpStatusCode.NoContent; }
  • For API details, see AddTagsToVault in Amazon SDK for .NET API Reference.

Amazon CLI

The following command adds two tags to a vault named my-vault:

aws glacier add-tags-to-vault --account-id - --vault-name my-vault --tags id=1234,date=july2015

Amazon Glacier requires an account ID argument when performing operations, but you can use a hyphen to specify the in-use account.

  • For API details, see AddTagsToVault in Amazon CLI Command Reference.

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.