MSP360 Explorer PowerShell snippets for Amazon Glacier
As always we are adding features to make it easier for our customers to use the functionality to offer the most compelling Amazon S3, CloudFront, IAM, and Glacier client on Windows platform.
MSP360 S3 Explorer has supported Glacier for quite some time now. We introduced the Glacier support in September, followed by supporting encryption and compression and finally Amazon S3 to Glacier archiving.
Since the very first release, MSP360 Explorer featured PowerShell extension to automate Amazon S3 and CloudFront tasks. The latest release of MSP360 Explorer comes with a PowerShell extension that helps users automate Glacier tasks and integrate it with other PowerShell routines. The extension includes commands such as create, delete vaults, copy and move data to Glacier, create Inventory and Retrieval jobs and create Lifecycle policies.
Here are a few examples of PowerShell commands.
How to Copy the Files to Amazon Glacier Using MS Powershell
Powershell is provided as is in MSP360 Explorer
# Add snap-in
add-pssnapin CloudBerryLab.Explorer.PSSnapIn
# Enable logging and specify path
Set-Logging -LogPath "C:UsersusernameAppDataLocalCloudBerry S3 Explorer PROLogsPowerShell.log" -LogLevel Info
# Create connection
$conn = Get-CloudGlacierConnection -Key XXXXXXXXXXXXXXXXXXXXXXXXX -Secret XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Set options
Set-CloudOption -GlacierRetrievalRateLimitType Specified Set-CloudOption -GlacierChunkSizeMB 4 Set-CloudOption -GlacierParallelUpload 1
# Set peak retrieval rate, MB/hour
Set-CloudOption -GlacierPeakRetrievalRateLimit 23.5
# Select a vault
$vault = $conn | Select-CloudFolder -Path "us-east-1/vault1"
# Let's copy to the vault
$destination = $vault
# Select source folder
$src = Get-CloudFilesystemConnection | Select-CloudFolder "C:Tmp"
# Upload files to Glacier by the filter
$src | Copy-CloudItem $destination -filter "sample.txt"
# Upload all files to Glacier
$src | Copy-CloudItem $destination -filter "*"
# Delete vault
$conn | Remove-CloudBucket $vault
How to Copy the File Form Amazon Glacier to Local Computer
# Add snap-in
add-pssnapin CloudBerryLab.Explorer.PSSnapIn
# Enable logging and specify path
Set-Logging -LogPath "C:UsersusernameAppDataLocalCloudBerry S3 Explorer PROLogsPowerShell.log" -LogLevel Info
# Create connection
$conn = Get-CloudGlacierConnection -Key XXXXXXXXXXXXXXXXXXXXXX -Secret XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Get existing vault
$vault = $conn | Select-CloudFolder -Path "us-east-1/vault1"
# Get vault inventory.
# Note: this command may take up to 5 hours to execute if inventory has not been prepared yet.
$invJob = $vault | Get-Inventory
# Now read vault archives
$archives = $vault | get-clouditem
# Select destination local folder.
$dst = Get-CloudFilesystemConnection | Select-CloudFolder "C:Tmp"
# Copy files from the vault. Only files located in C:Tmp folder and subfolders will be copied.
# Note: this command may take many hours to execute when files have not been prepared for copying yet.
$vault | Copy-CloudItem $dst -filter "C:Tmp*.*"
The complete list of commands is available on our website in the CLI commands guide.