Ian Campbell: Setting absolute date based Amazon S3 bucket lifecycles with curl
For my local backup regimen I use flexbackup to create a
full backup twice a year and differential/incremental backups on a
weekly/monthly basis. I then upload these to a new amazon S3 bucket
for each half year (so each bucket corresponds to the a full backup
plus the associated differentials and incrementals).
I then set the bucket's lifecycle to archive to glacier (cheaper
offline storage) from the month after that half year has ended
(reducing costs) and to delete it a year after the half ends. It used
to be possible to do this via the S3 web interface but the absolute
date based options seem to have been removed in favour of time since
last update, which is not what I want. However the UI will still
display such lifecycles if they are configured and directs you to the
REST
API to
set them up.
I had a look around but couldn't any existing CLI tools to do this
directly but I figured it must be possible with curl. A
little bit of reading later I found that it was possible but it
involved some faff calculating signatures etc. Luckily
EricW has
written Amazon S3 Authentication Tool for Curl
(AKA s3curl) which automates the majority of that faff. The tool is "New BSD"
licensed according to that page or Apache 2.0 license according to the
included LICENSE file and code comments.
Setup
Following the included README setup
~/.s3curl containing your id and
secret key (I called mine personal which I then use below).
Getting the existing lifecycle
Retrieving an existing lifecycle is pretty easy. For the bucket which
I used for the first half of 2014:
$ s3curl --id=personal -- --silent http://$bucket.s3.amazonaws.com/?lifecycle xmllint --format -
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ID>Archive and Expire</ID>
<Prefix/>
<Status>Enabled</Status>
<Transition>
<Date>2014-07-31T00:00:00.000Z</Date>
<StorageClass>GLACIER</StorageClass>
</Transition>
<Expiration>
<Date>2015-01-31T00:00:00.000Z</Date>
</Expiration>
</Rule>
</LifecycleConfiguration>
See GET Bucket
Lifecycle
for details of the XML.
Setting a new lifecycle
The desired configuration needs to be written to a file. For example
to set the lifecycle for the bucket I'm going to use for the second
half of 2014:
$ cat s3.lifecycle
<LifecycleConfiguration>
<Rule>
<ID>Archive and Expire</ID>
<Prefix/>
<Status>Enabled</Status>
<Transition>
<Date>2015-01-31T00:00:00.000Z</Date>
<StorageClass>GLACIER</StorageClass>
</Transition>
<Expiration>
<Date>2015-07-31T00:00:00.000Z</Date>
</Expiration>
</Rule>
</LifecycleConfiguration>
$ s3curl --id=personal --put s3.lifecycle --calculateContentMd5 -- http://$bucket.s3.amazonaws.com/?lifecycle
See PUT Bucket
Lifecycle
for details of the XML.
After dealing with the
Since the release of
In short: I love my MacBook Air. It is the best (laptop) hardware
I ever owned. I have seen hardware which was much more flaky
in the past. I can set the display backlight to zero via software,
which saves me a lot of battery life and also offers a bit
of anti-spy-acroos-my-shoulder support. WLAN and bluetooth work nicely.
And I just love the form-factor and the touch-feeling of the hardware.
I even had the bag I use to carry my braille display
modified so that the Air just fits in.
I can't say how it behaves with X11. Given how flaky accessibility
with graphical desktops on Linux is, I have still not made
the switch. My MacBookAir is my perfect mobile terminal, I LOVE it.
I am sort of surprised about the recent rant of 






The security model on the Google Nexus devices is pretty straightforward. The OS is (nominally) secure and prevents anything from accessing the raw MTD devices. The bootloader will only allow the user to write to partitions if it's unlocked. The recovery image will only permit you to install images that are signed with a trusted key. In combination, these facts mean that it's impossible for an attacker to modify the OS image without unlocking the bootloader[1], and unlocking the bootloader wipes all your data. You'll probably notice that.
A few interesting things happened after I got a macbook air.
This is my monthly summary of my free software related activities. If you re among the people who
With the help of the Debian System Administrators, it s now setup on 












I have a number of USB hard disks. Like, I suppose, mostly everyone who
reads this blog. Unlike many people who do, however, for whatever reason
I decided to create LVM volumes on most of my USB hard disks. The
unfortunate result is that these now contain a lot of data with a
somewhat less than efficient partitioning system.
I don't really care much, but it's somewhat annoying, not in the least
because disconnecting an LVM device isn't as easy as it used to be;
originally you could just run the
1. This weekend I will apply to rejoin the Debian project, as a developer.
2. In the meantime I've been begun releasing some
There are only left 3 days to submit your talk.