Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Creating a Bucket

Give Feedback

To start off, you need an S3 bucket. To create one programmatically, you must first choose a name for your bucket. Remember that this name must be unique throughout the whole AWS platform, as bucket names are DNS compliant.

If you try to create a bucket, but another user has already claimed your desired bucket name, your code will fail. Instead of success, you will see the following error: botocore.errorfactory.BucketAlreadyExists. You can increase your chance of success when creating your bucket by picking a random name. You can generate your own function that does that for you.

bdorsey327 on Feb. 2, 2020

I’m getting error’s about regarding boto3 not being able to locate credentials even though I’ve configured the profile, credentials and config with the correct info. Also, I’ve had to modify the script b/c of the us-east api issue in order to get it to create a bucket. The script provided in the video results in an error even with the if/else logic provided

Joe Tatusko RP Team on Feb. 5, 2020

Hi bdorsey, are you located in the us-east region?

bdorsey327 on Feb. 13, 2020

yes I am

pksccbt on March 3, 2020

Hi I am getting error Invalid type for parameter CreateBucketConfiguration.LocationConstr aint, value: None, type: <class ‘NoneType’>, valid types: <class ‘s tr’>

Joe Tatusko RP Team on March 4, 2020

Hi pksccbt, it looks like boto3 is not able to read your region. Did you set up a config file at the end of the Installation and Setup video?

Should be located at ~/.aws/config and contain:

[default]
region = YOUR_PREFERRED_REGION

pksccbt on March 4, 2020

Yes I had set my region. It is region = us-east-2

pksccbt on March 6, 2020

Hi it is still not working.

Joe Tatusko RP Team on March 6, 2020

Interesting, I’m not sure why it wouldn’t collect that info correctly.

Can you post the entire error traceback? I’d like to see if it’s your S3 connection or the bucket creation line that is causing the problem. Somewhere your ‘us-east-2’ region is not being passed to boto3 the right way.

Thanks!

purplepython on May 9, 2020

I’m getting an error when I try to run s3_resource= boto3.resource(‘s3’) with AttributeError: module boto3 has no attribute ‘resource’ I’m running python3 and boto3 is up to date. This is when i try the part in the interactive shell to create the bucket.

crystal9563 on May 29, 2020

I get the following error message in my python session.

>>> first_bucket_name, first_response = create_bucket(
... 
... bucket_prefix='firstpythonbucket',
... s3_connection=s3_resource.meta.client)
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
NameError: name 's3_resource' is not defined

Has anyone else got this same issue?

barringermargaret on June 11, 2020

Was getting errors as well. The following worked for me after looking at video & tutorial.`#s3 bucket using a client

import boto3 from boto3_guide import create_bucket s3_resource = boto3.resource(‘s3’) first_bucket_name, first_response = create_bucket( … bucket_prefix=’firstpythonbucket’, … s3_connection=s3_resource.meta.client) firstpythonbucket5db905a0-b49d-4fa5-9d43-4f990c403de5 us-east-1

s3 bucket using a resource

second_bucket_name, second_response = create_bucket( … bucket_prefix=’secondpythonbucket’, s3_connection=s3_resource) secondpythonbucketf2039215-b1d1-4f2c-99ea-7ed5d4696858 us-east-1`

Become a Member to join the conversation.