{"id":16,"date":"2013-01-28T14:30:00","date_gmt":"2013-01-28T10:30:00","guid":{"rendered":"http:\/\/yohoho.msp360.com\/?p=16"},"modified":"2020-12-25T15:21:33","modified_gmt":"2020-12-25T11:21:33","slug":"upload-to-amazon-glacier-using-powershell","status":"publish","type":"post","link":"https:\/\/www.msp360.com\/resources\/blog\/upload-to-amazon-glacier-using-powershell\/","title":{"rendered":"Upload to Amazon Glacier using PowerShell"},"content":{"rendered":"<h2>MSP360 Explorer PowerShell snippets for Amazon Glacier<\/h2>\n<p>As always we are adding features to make it easier for our customers to use the functionality to offer the most compelling <a href=\"http:\/\/aws.amazon.com\/s3\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Amazon S3<\/a>, <a href=\"http:\/\/aws.amazon.com\/cloudfront\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CloudFront<\/a>, <a href=\"http:\/\/aws.amazon.com\/iam\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">IAM<\/a>, and <a href=\"http:\/\/aws.amazon.com\/glacier\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Glacier<\/a> client on Windows platform.<br \/>\nMSP360 S3 Explorer has supported Glacier for quite some time now.\u00a0 We introduced the <a href=\"https:\/\/www.msp360.com\/resources\/blog\/amazon-s3-glacier\/\" target=\"_blank\" rel=\"noopener noreferrer\">Glacier support<\/a> in September, followed by supporting encryption and compression and finally <a href=\"https:\/\/www.msp360.com\/resources\/blog\/how-to-archive-data-from-amazon-s3-to-glacier-with-cloudberry-explorer\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon S3 to Glacier archiving<\/a>.<br \/>\nSince the very first release, <a href=\"https:\/\/www.msp360.com\/explorer\/powershell.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">MSP360 Explorer featured PowerShell extension<\/a> 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.<br \/>\n<!--more--><\/p>\n<p>Here are a few examples of PowerShell commands.<\/p>\n<h2>How to Copy the Files to Amazon Glacier Using MS Powershell<\/h2>\n<p>Powershell is provided as is in MSP360 Explorer<br \/>\n# Add snap-in<\/p>\n<pre>add-pssnapin CloudBerryLab.Explorer.PSSnapIn<\/pre>\n<p># Enable logging and specify path<\/p>\n<pre>Set-Logging -LogPath \"C:UsersusernameAppDataLocalCloudBerry S3 Explorer PROLogsPowerShell.log\" -LogLevel Info<\/pre>\n<p># Create connection<\/p>\n<pre>$conn = Get-CloudGlacierConnection -Key XXXXXXXXXXXXXXXXXXXXXXXXX -Secret XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<\/pre>\n<p># Set options<\/p>\n<pre>Set-CloudOption -GlacierRetrievalRateLimitType Specified\r\n\u00a0\r\nSet-CloudOption -GlacierChunkSizeMB 4\r\n\u00a0\r\nSet-CloudOption -GlacierParallelUpload 1<\/pre>\n<p># Set peak retrieval rate, MB\/hour<\/p>\n<pre>Set-CloudOption -GlacierPeakRetrievalRateLimit 23.5<\/pre>\n<p># Select a vault<\/p>\n<pre>$vault = $conn | Select-CloudFolder -Path \"us-east-1\/vault1\"<\/pre>\n<p># Let's copy to the vault<\/p>\n<pre>$destination = $vault<\/pre>\n<p># Select source folder<\/p>\n<pre>$src = Get-CloudFilesystemConnection | Select-CloudFolder \"C:Tmp\"<\/pre>\n<p># Upload files to Glacier by the filter<\/p>\n<pre>$src | Copy-CloudItem $destination -filter \"sample.txt\"<\/pre>\n<p># Upload all files to Glacier<\/p>\n<pre>$src | Copy-CloudItem $destination -filter \"*\"<\/pre>\n<p># Delete vault<\/p>\n<pre>$conn | Remove-CloudBucket $vault<\/pre>\n<h2>How to Copy the File Form Amazon Glacier to Local Computer<\/h2>\n<p># Add snap-in<\/p>\n<pre>add-pssnapin CloudBerryLab.Explorer.PSSnapIn<\/pre>\n<p># Enable logging and specify path<\/p>\n<pre>Set-Logging -LogPath \"C:UsersusernameAppDataLocalCloudBerry S3 Explorer PROLogsPowerShell.log\" -LogLevel Info<\/pre>\n<p># Create connection<\/p>\n<pre>$conn = Get-CloudGlacierConnection -Key XXXXXXXXXXXXXXXXXXXXXX -Secret XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<\/pre>\n<p># Get existing vault<\/p>\n<pre>$vault = $conn | Select-CloudFolder -Path \"us-east-1\/vault1\"<\/pre>\n<p># Get vault inventory.<br \/>\n# Note: this command may take up to 5 hours to execute if inventory has not been prepared yet.<\/p>\n<pre>$invJob = $vault | Get-Inventory<\/pre>\n<p># Now read vault archives<\/p>\n<pre>$archives = $vault | get-clouditem<\/pre>\n<p># Select destination local folder.<\/p>\n<pre>$dst = Get-CloudFilesystemConnection | Select-CloudFolder \"C:Tmp\"<\/pre>\n<p># Copy files from the vault. Only files located in C:Tmp folder and subfolders will be copied.<br \/>\n# Note: this command may take many hours to execute when files have not been prepared for copying yet.<\/p>\n<pre>$vault | Copy-CloudItem $dst -filter \"C:Tmp*.*\"<\/pre>\n<p>The complete list of commands is available on our website in the <a href=\"https:\/\/www.msp360.com\/explorer\/powershell.aspx\">CLI commands guide.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.\u00a0 We introduced the Glacier support [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[877,898,882],"tags":[],"class_list":["post-16","post","type-post","status-publish","format-standard","hentry","category-blog-articles","category-msp360-explorer","category-msp360-news"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":0,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.msp360.com\/resources\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}