Project

General

Profile

s3.py

Yiu Chung Lee, 11/02/2016 09:23 AM

Download (503 Bytes)

 
1
#!/usr/bin/env python
2
import boto3
3
from botocore.utils import fix_s3_host
4

    
5
access_key = 'afbf6ce3f38d4ad0953d927acc15f032'
6
secret_key = '897e564a132042b3b0910e27eb82b244'
7

    
8
conn = boto3.resource("s3",
9
         aws_access_key_id=access_key,
10
         aws_secret_access_key=secret_key,
11
         endpoint_url="http://127.0.0.1:7480",
12
       )
13
conn.meta.client.meta.events.unregister('before-sign.s3', fix_s3_host)
14
conn.create_bucket(Bucket='s3-bucket')
15
for bucket in conn.buckets.all():
16
  print bucket.name
17