Snippets of the day – Tuesday, November 12, 2013

Posted on Posted in Snippets

orange-scissors-pen

Here are some of the most recently published snippets!

Amazon S3 Aws – How to get the reference to a bucket

This code shows how to get the reference to an existing bucket on Amazon S3 account, using boto python API.
You need to specify the bucket name as unique key and invoke the get_bucket method provided by S3Connection object.

Prerequisites:
You need an existing bucket.

Open the snippet

Author:    lbottaro @ Amazon_AWS_Python_API

Amazon S3 Aws – Change an object’s acl using boto API

This code shows how to change the access rights on a file uploaded on S3 storage.
This example sets the object foo_bar.txt to be publicly readable, and secret.txt to be private.

Supported acl values defined in boto.gs.acl.py.

CannedACLStrings = [‘private’, ‘public-read’, ‘project-private’, ‘public-read-write’, ‘authenticated-read’, ‘bucket-owner-read’, ‘bucket-owner-full-control’]

Learn more about CannedACLStrings: [https://github.com/boto/boto/blob/develop/boto/gs/acl.py](https://github.com/boto/boto/blob/develop/boto/gs/acl.py)

Open the snippet

Author:    lbottaro @ Amazon_AWS_Python_API

Leave a Reply

Your email address will not be published. Required fields are marked *