Workshop 15: Python boto3 API
$count++; if($count == 1) { include "../mobilemenu.php"; } if ($count == 2) { include "../sharemediasubfolder.php"; } ?>
boto3 is an API used in python to connect to AWS.
In this workshop let us see how boto3 can be used to create a new s3 bucket.
Login to your EC2 instance. Become root.
Install boto3 using the following command.
# pip install boto3
In python we can then use boto3 to create S3 bucket.
>>> import boto3
>>> dir(boto3)
>>> dir(boto3.session)
>>> s = boto3.session
>>> session_instance = s.Sesssion
>>> s.Session.region_name = "ap-south-1"
>>> s.Session.resource = "s3"
>>> s3 = boto3.client("s3")
>>> s3.create_bucket("Bucket='myuniquebucket'")
In the above example, we created a bucket called myuniquebucket.