· 7 years ago · Oct 05, 2018, 11:18 AM
1import boto3
2
3ACCESS_KEY = 'theaccesskey'
4SECRET_KEY = 'thesecretkey'
5
6S3 = boto3.client('s3',
7 aws_access_key_id = ACCESS_KEY,
8 aws_secret_access_key = SECRET_KEY)
9
10response = S3.create_bucket(Bucket='mynewbucket',
11 CreateBucketConfiguration={'LocationConstraint':'ap-south-1'})
12
13botocore.errorfactory.BucketAlreadyExists: An error occurred (BucketAlreadyExists)
14when calling the CreateBucket operation: The requested bucket name is not available.
15The bucket namespace is shared by all users of the system.
16Please select a different name and try again.