Skip to Content
Hybrid Cloud for Developers
book

Hybrid Cloud for Developers

by Manoj Hirway
April 2018
Intermediate to advanced content levelIntermediate to advanced
280 pages
8h 37m
English
Packt Publishing
Content preview from Hybrid Cloud for Developers

Creating a bucket

A simple example of creating an S3 bucket using Python is as follows. We first import the boto3 Python library in our application and then create an object of type S3. Then, using this object, we simply invoke the create_bucket() function and pass the name of the bucket to be created. The Bucket parameter of the create_bucket() function is mandatory. There are other parameters that are used to set the properties of the bucket such as permissions, region, and so on. 

The following is the simplest implementation of the boto3 library, which will create a bucket named packt-pub-bucket

import boto3s3 = boto3.resource('s3')s3.create_bucket(Bucket='packt-pub')

Notice that we created an S3 bucket by writing only three lines of ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hybrid Cloud for Architects

Hybrid Cloud for Architects

Alok Shrivastwa
OpenStack: Building a Cloud Environment

OpenStack: Building a Cloud Environment

Alok Shrivastwa, Sunil Sarat, Kevin Jackson, Cody Bunch, Egle Sigler, Tony Campbell

Publisher Resources

ISBN: 9781788830874Supplemental Content