Amazon S3是来自Amazon的云(Amazon)存储解决方案(storage solution),以相对较低的价格提供无限的存储容量(storage capacity)。我目前使用它来备份我的本地NAS(网络附加存储)设备。但是,Amazon S3 并不是(Amazon S3 isn)存储大量您不会经常访问的数据的最佳选择。
Amazon Glacier是 Amazon 提供的一种解决方案,它(Amazon)极大地降低了在云中存储大量数据的成本,例如,在S3 上存储 2500 GB 数据的成本(S3 cost)约为每月 215 美元。仅用于备份您的数据,这已经是一大笔钱了。但是,在Amazon Glacier(Amazon Glacier)上存储 2500 GB每月只需 25 美元。这几乎是 S3 成本的 1/10。
那么如何将数据从Amazon S3移动到Glacier?使用生命周期(Lifecycle) 策略(Policies)。这些策略基本上只是您可以设置以在特定时间将数据从 S3 移动到Glacier的规则。(Glacier)让我们学习如何创建生命周期策略(Lifecycle Policy)。
(Create Lifecycle Policy)在Amazon S3上(Amazon S3)创建生命周期策略
要开始使用,请先登录Amazon Web Services (aws.amazon.com),然后单击顶部的My Account/Console然后单击AWS 管理控制台(AWS Management Console)。
现在从列出的Amazon Web服务列表中,继续并单击 S3。
接下来单击包含要传输到Glacier的数据的(Glacier)存储桶名称(bucket name)。请注意,您将能够传输整个存储桶,仅传输文件夹,甚至仅传输特定文件。
打开存储桶时,您会在左侧看到存储桶的内容(hand side)。单击右上角(Click)的属性(Properties)以打开该存储桶的设置。
在底部,您会看到Lifecycle。继续并展开Lifecycle以查看您当前的规则(如果有)。我已经有一个设置,可以在存储桶中的所有内容上传到 S3 后将其传输到Glacier 。
要设置新规则,请继续并单击Add rule。将弹出新的生命周期规则对话框,如下所示。(Lifecycle rule)
现在让我们来看看不同的选项。首先,你可以给它一个名字,它可以是你生活的任何东西。应用到整个存储桶(Apply to Entire Bucket) 复选框(check box)会将规则应用于存储桶内的所有文件和文件夹。如果您只想将数据的特定部分移动到Glacier并将其余部分留在 S3 中,则不要选中该框。
相反,您可以输入Prefix,即要移动到Glacier的(Glacier)文件或文件夹(file or folder)的名称。例如,如果我只想将存储桶中的音乐文件夹移动到(music)Glacier,我会在前缀(Prefix)框中键入music/要指定一个文件,请输入类似music/mymusic.mp3的路径。
接下来是时间段格式(Time Period Format)。您可以选择Days from the creation date或Effective from date。此选项允许您选择何时要将指定的对象移动到Glacier中。如果您从创建日期(creation date)中选择天数,例如,您可以说您希望在 10 天后将数据移动到Glacier 。这意味着当文件是数据首次上传到 S3 时,它将在创建 10 天后移动到Glacier 。
从日期开始生效,您只需指定未来的日期,在该日期数据将传输到Glacier。您必须单击“添加转换(Add Transition)”按钮才能指定时间段(time period)。我的屏幕截图显示“移至(Move)冰川”,但那是因为我已经创建了规则。当您单击Add Transition时,您可以输入天数或日期。请注意,如果您输入 0 作为天数,则下次运行规则时数据将立即移动。
还有一个过期(Expiration)按钮,但要小心。同样(Again),根据您从时间段格式(Time Period Format)中选择的内容,您可以指定未来的天数或特定日期。添加过期时间意味着数据将在您指定的时间后被删除。请务必记住,它将从 S3、RRS 和 Glacier(RRS and Glacier)中删除。因此,如果您选择添加到期时间,基本上它就完全消失了。
如果您不添加过期时间,则数据将始终保留在Glacier中而不会被删除。差不多就是这样。保存规则后,该规则将每天运行一次。如果您的规则符合您指定的条件,则将传输数据。
关于这个过程,有几点需要注意。首先,您可以通过检查Storage Class来判断您的数据已移至Glacier。如果是Standard,那就是 S3。如果是RRS,那就是 Reduced Redundancy。第三类是Glacier,这意味着它现在存储在那里。
另一件需要注意的是,当您将数据从 S3 移动到Glacier时,您仍然必须从 S3 访问它。如果您将数据直接上传到Glacier ,当您登录AWS时,它将显示在Glacier 控制台(Glacier console)中。但是,使用生命周期(Lifecycle)规则移动数据意味着数据将存储在Glacier中,您需要支付Glacier价格,但您必须从S3 控制台(S3 console)访问数据。有点(Kind)令人困惑,但这就是它的工作原理。
从 Glacier 检索数据
从Glacier获取数据也非常简单。关于Glacier(Glacier) ,需要记住的一点是数据不能像 S3 那样立即访问。使用 S3,您可以随时下载任何文件。使用Glacier,您必须等待大约 3 到 5 个小时才能检索数据并将其放回 S3。这也是它便宜得多的原因。
要开始还原,请选择要检索的文件或文件夹(file or folder),然后右键单击它。您将看到一个名为Initiate Restore的选项。
如果该选项被禁用,则意味着文件未存储在Glacier中。还原时,您必须选择希望数据在 S3 中可访问多长时间。
请注意,这些文件将恢复到S3 RRS(减少冗余(Reduced Redundancy))存储类,它比(storage class)S3 标准(S3 Standard)便宜一点。另请注意,您无法永久恢复数据,最终将被删除。我不确定您可以输入几天来保留数据的最大值,但这不是永远的。此外,数据存放在RRS(RRS) 存储类(storage class)中的时间越长,您就必须支付越高的费用,因此最好保持较短的持续时间。
要查看恢复的状态,只需单击您恢复的文件或文件夹(file or folder),然后单击属性(Properties)。它会说Restoration in Progress。还原完成并再次单击“属性”后,您将看到还原将保留到的日期。
总体而言,将数据从 S3 传输到Glacier非常容易。只需(Just)创建一个规则,您就完成了。如果您在 S3 上有大量数据,则将数据移动到Glacier可能意味着节省大量资金。(Glacier)如果您有任何问题,请发表评论。享受!
How to Move Amazon S3 Data to Glacier
Αmazоn S3 is a cloud storage solution from Αmazon that provides infinite storаge capacity for relatively-low prices. I currently use it to keep a backup of my local NAS (network attached storage) device. However, Amazon S3 isn’t the best option for storing a large amount of data that you won’t access very often.
Amazon Glacier is a solution provided by Amazon that dramatically reduces the cost of storing large amounts of data in the cloud For example, storing 2500 GB of data on S3 cost about $215 a month. That’s quite a bit of money for just backing up your data. However, storing 2500 GB on Amazon Glacier will only cost you only $25 a month. That’s almost 1/10 the cost of S3.
So how do you move your data from Amazon S3 to Glacier? Using Lifecycle Policies. These policies are basically just rules that you can setup to move the data from S3 to Glacier at specific times. Let’s learn how to create a Lifecycle Policy.
Create Lifecycle Policy on Amazon S3
To get started, first go ahead and log into Amazon Web Services (aws.amazon.com) and click on My Account/Console at the top. Then click on AWS Management Console.
Now from the list of Amazon Web services listed, go ahead and click on S3.
Next click on the bucket name that contains the data you want to transfer to Glacier. Note that you will be able to either transfer the entire bucket, just folders or even specific files only.
When you open a bucket, you’ll see the content of the bucket on the left hand side. Click on Properties at the top right to open the settings for that bucket.
At the bottom, you’ll see Lifecycle. Go ahead and expand Lifecycle to see your current rules, if any. I have one setup already which transfers everything in the bucket to Glacier after it’s uploaded to S3.
To setup a new rule, go ahead and click on Add rule. The new Lifecycle rule dialog will pop up as shown below.
Now let’s go through the different options. Firstly, you can give it a name, which can be whatever you life. The Apply to Entire Bucket check box will apply the rule to all files and folders inside the bucket. If you want to only move a certain portion of the data to Glacier and leave the rest in S3, then do not check the box.
Instead, you can enter a Prefix, which is the name of the file or folder you want to move to Glacier. For example, if I wanted to just move the music folder in my bucket to Glacier, I would type music/ in the Prefix box. To specify a file, you type in the path like music/mymusic.mp3.
Next is Time Period Format. You can either choose from Days from the creation date or Effective from date. This option lets you choose when you want the objects you specified to be moved into Glacier. If you choose Days from the creation date, you can say, for example, that you want to move the data to Glacier after 10 days. This means when the file is data is first uploaded to S3, it will be moved to Glacier after 10 days of being created.
Effective from date will let you just specify a date in the future at which point the data will be transferred to Glacier. You have to click on the Add Transition button in order to specify the time period. My screenshot says “Move to Glacier”, but that’s because I already created a rule. When you click Add Transition, you can type in the number of days or the date. Note that if you type in 0 for the number of days, then the data will be moved immediately the next time the rule is run.
There is also an Expiration button, but be careful with this. Again, depending on what you chose from Time Period Format, you can either specify a number of days or specific date in the future. Adding an expiration means the data will be deleted after the time you specify. It’s important to remember that it will be deleted from S3, RRS and Glacier. So basically it’s completely gone if you choose to add an expiration.
If you don’t add an expiration, the data will always remain in Glacier and not be deleted. That’s pretty much it. Once you save the rule, the rule will be run once a day. If your rule matches the criteria you specified, the data will be transferred.
There are a few things to note about this process. Firstly, you can tell your data has been moved to Glacier by checking the Storage Class. If it’s Standard, that is S3. If it’s RRS, that is Reduced Redundancy. The third class is Glacier, which means it’s now stored there.
Another thing to note is that when you move data from S3 to Glacier, you still have to access it from S3. If you upload data straight to Glacier, it will show up in the Glacier console when you log into AWS. However, moving data using Lifecycle rules means the data will be stored in Glacier and you’ll be charged Glacier prices, but you’ll have to access the data from the S3 console. Kind of confusing, but that’s how it works.
Retrieving Data from Glacier
Getting data back from Glacier is also pretty straight-forward. The thing to remember about Glacier is that data is not immediately accessible like in S3. With S3, you can download any file any time. With Glacier, you have to wait about 3 to 5 hours for the data to be retrieved and put back into S3. That’s also why it’s so much cheaper.
To start a restore, select the file or folder that you want to retrieve and then right-click on it. You’ll see an option called Initiate Restore.
If the option is disabled, that means the file is not stored in Glacier. When you restore, you’ll have to choose how long you want the data to be accessible in S3.
Note that the files are restored to S3 RRS (Reduced Redundancy) storage class, which is a little bit cheaper than S3 Standard. Also note that you cannot permanently restore the data, it will be deleted eventually. I’m not sure what the largest value you can enter for days to keep the data, but it’s not forever. Also, you have to pay the higher fees the longer that data sits in RRS storage class, so it’s better to keep the duration short.
To see the status of a restoration, just click on the file or folder you restored and click on Properties. It will say Restoration in Progress. When the restore is complete and you click Properties again, you’ll see the date that the restore will be kept to.
Overall, getting your data from S3 to Glacier is very easy. Just create one rule and you’re done. Moving data to Glacier can mean big savings if you have a lot of data on S3. If you have any questions, please post a comment. Enjoy!