Amazon S3 Aws - Creating a bucket in python

This code shows how to create a new bucket using boto API on a S3 Amazon account.   
Please note that the name of the bucket must be unique, different from any other bucket existing in Amazon S3 storage. For this reason you can add some random value to make it unique.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
import boto import boto.s3.connection access_key = '<aws access key>' secret_key = '<aws secret key>' # This code initialize the Amazon S3 connection to your account conn = boto.connect_s3( aws_access_key_id = access_key, aws_secret_access_key = secret_key) # This creates a new bucket called myBucket bucket = conn.create_bucket('myBucket')

Other Steps and Solutions

If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus