Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved the IllegalLocationConstrationException while creating Bucket in us-ease-1 region #45

Open
anujkp-97 opened this issue May 2, 2024 · 0 comments

Comments

@anujkp-97
Copy link

Creating S3 bucket using Boto3

I was creating an S3 bucket but, Exception IllegalLocationConstrationException. By default S3 bucket was created in US-east-1 region.
To solve this Exception, I provided the location to the bucket ap-south-1 and s3 bucket created successfully.

Here is the code:

import boto3

client = boto3.client('s3')

response = client.create_bucket(

Bucket='<your-bucket-name>',
CreateBucketConfiguration={'LocationConstraint': 'ap-south-1'}

)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant