github.com/sbuss/deis@v1.6.1/registry/templates/create_bucket (about)

     1  #!/usr/bin/env python
     2  
     3  import boto
     4  import sys
     5  from boto.s3.connection import OrdinaryCallingFormat
     6  
     7  conn = boto.connect_s3(
     8      aws_access_key_id='{{ getv "/deis/store/gateway/accessKey" }}',
     9      aws_secret_access_key='{{ getv "/deis/store/gateway/secretKey" }}',
    10      host='{{ getv "/deis/store/gateway/host" }}',
    11      port={{ getv "/deis/store/gateway/port" }},
    12      is_secure=False,
    13      calling_format=OrdinaryCallingFormat())
    14  name = '{{ getv "/deis/registry/bucketName" }}'
    15  
    16  if name not in (bucket.name for bucket in conn.get_all_buckets()):
    17      conn.create_bucket(name)