CloudBerry 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.
CloudBerry
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 CloudBerry
Explorer featured PowerShell extension to automate Amazon S3 and CloudFront
tasks. The latest release
of CloudBerry 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 is a few examples of PowerShell command.
How to copy the files to Amazon Glacier using MS PowerShell
# Add snap-in
add-pssnapin CloudBerryLab.Explorer.PSSnapIn
# Enable logging and specify path
Set-Logging -LogPath "C:\Users\username\AppData\Local\CloudBerry
S3 Explorer PRO\Logs\PowerShell.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 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:\Users\username\AppData\Local\CloudBerry
S3 Explorer PRO\Logs\PowerShell.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 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 at
http://www.cloudberrylab.com/default.aspx?page=amazon-s3-powershell
+++
Note: this post applies to CloudBerry
Explorer freeware 3.7.3 and later.
As always we would be happy to hear your feedback and you
are welcome to post a comment.
CloudBerry
S3 Explorer is a Windows freeware product that helps managing Amazon S3 storage and CloudFront . You can
download it at http://www.cloudberrylab.com/free
CloudBerry
S3 Explorer PRO is a Windows program that helps managing Amazon S3 storage and CloudFront . You can
download it at http://www.cloudberrylab.com/pro It is priced at $39.99
Want to get CloudBerry Explorer PRO for FREE? Make a blog
post about us!
No comments:
Post a Comment