Export to GitHub

aws-glacier-app - Usage.wiki


Introduction

AWS Glacier app is a simple Java command line tool built on top of AWS Glacier Java SDK samples. I needed such an app for some of my web projects

Installation

Get ZIP from the Downloads section and unzip it. Add your AWS access key and secret key in the AwsCredentials.properties.

Usage

Make sure you provide the correct absolute paths to JAR and files in the command line.

java -jar AwsGlacierApp.jar confg-file vault|archive ...see below for their params...

vault create name

vault describe name

vault delete name

vault list

archive upload vaultName newArchiveName filePathToBeArchived

archive download vaultName archiveId newFilePathToStoreTheArchive

archive delete vaultName archiveId

Examples

Create Vault 'test1'

java -jar "AwsGlacierApp.jar" "AwsCredentials.properties" vault create test1

Prints something like: /112233445566/vaults/test1

Create Vault 'test2'

java -jar "AwsGlacierApp.jar" "AwsCredentials.properties" vault create test2

Prints something like: /112233445566/vaults/test2

List Vaults

java -jar "AwsGlacierApp.jar" "AwsCredentials.properties" vault list

Prints something like:

[ CreationDate: 2012-10-07T09:37:08.926Z

LastInventoryDate: null

NumberOfArchives: 0

SizeInBytes: 0

VaultARN: arn:aws:glacier:us-east-1:112233445566:vaults/test1

VaultName: test1,

CreationDate: 2012-10-07T09:37:18.948Z

LastInventoryDate: null

NumberOfArchives: 0

SizeInBytes: 0

VaultARN: arn:aws:glacier:us-east-1:112233445566:vaults/test2

VaultName: test2]

Delete Vault 'test2'

java -jar "AwsGlacierApp.jar" "AwsCredentials.properties" vault delete test2

Upload a file, thus creating a new archive

java -jar "AwsGlacierApp.jar" "AwsCredentials.properties" archive upload test1 "sample.txt"

where "test1" is the vault's name where the archive will be created and "sample.txt" is the local file to be archived on Glacier

Prints archive ID, something like

nqkMw-lo7tuMX34VLDoU99FhLyzfJyga7doVazz3AvpxZaI-5PzWNfzv0n8rewZTfO59z443uOqMpS5abls2Fvy888lJe6yTKaKWCZVp1ZO_COa_JnOUJncI9RbRY_ZRYcXRXuLb77

Download an archive

You will need the archive's ID and the vault's name

java -jar "AwsGlacierApp.jar" "AwsCredentials.properties" archive download test1 "nqkMw-lo7tuMX34VLDoU99FhLyzfJyga7doVazz3AvpxZaI-5PzWNfzv0n8rewZTfO59z443uOqMpS5abls2Fvy888lJe6yTKaKWCZVp1ZO_COa_JnOUJncI9RbRY_ZRYcXRXuLb77" "sample_downloaded.txt"

where "sample_downloaded.txt" is the name of the new file to be created with content of the downloaded archive.

NOTE: the download takes hours! This is by Glacier's design. The app will block until the download is completed.

Delete an archive

java -jar "AwsGlacierApp.jar" "AwsCredentials.properties" archive delete test1 "nqkMw-lo7tuMX34VLDoU99FhLyzfJyga7doVazz3AvpxZaI-5PzWNfzv0n8rewZTfO59z443uOqMpS5abls2Fvy888lJe6yTKaKWCZVp1ZO_COa_JnOUJncI9RbRY_ZRYcXRXuLb77"