I'd like to use S3 CORS and key expiration to create a 'spool bucket'. This spool bucket should support the following:
HTTP PUT arbitrarily named keys to the bucketHow exactly should this be achieved?
After some mucking about, here's what I found:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*.example.com</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
x-amz-acl: bucket-owner-full-control. For example, in CoffeeScript and jQuery, your PUT will look like this:$.ajax http://my_spool_bucket.s3.amazonaws.com,
type: "PUT"
data: "contents of new object"
headers:
"x-amz-acl": "bucket-owner-full-control"
That's it. Bask in the glory of highly available, self-expunging, CORS compatible, cheap and easy HTTP spool space. One important thing to remember: any client can overwrite any key; you should design accordingly (I use cryptographically secure generated keys).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With