github.com/techend/deis@v1.0.1-0.20141111224634-e0eee0392b8a/database/templates/create_bucket (about)

     1  #!/usr/bin/env python
     2  import boto
     3  import sys
     4  from boto.s3.connection import OrdinaryCallingFormat
     5  
     6  conn = boto.connect_s3(host='{{ .deis_store_gateway_host }}',
     7                         port={{ .deis_store_gateway_port }},
     8                         is_secure=False,
     9                         calling_format=OrdinaryCallingFormat(),
    10                        )
    11  bucket = sys.argv[1]
    12  
    13  if not bucket in conn.get_all_buckets():
    14    conn.create_bucket(bucket)