title: Facing "IllegalLocationConstraintException" error
body: <p>I am trying to create a s3-bucket using AWS SDK for Python in PyCharm and facing the following error.</p>
  <blockquote>
  <p>&quot;An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.&quot;</p>
  </blockquote>
  <p>Here is my code:</p>
  <pre><code>import os
  
  import boto3
  from botocore.exceptions import ClientError
  
  ACCESS_KEY = 'AWS_ACCESS_KEY_ID'
  SECRET_KEY = 'AWS_SECRET_ACCESS_KEY'
  PRI_BUCKET_NAME = 'soundcloud2'
  TRANSIENT_BUCKET_NAME = 'soundcloud3'
  
  
  def main():
      &quot;&quot;&quot;entry point&quot;&quot;&quot;
      access = os.getenv(ACCESS_KEY)
      secret = os.getenv(SECRET_KEY)
      s3 = boto3.resource('s3', aws_access_key_id=access, aws_secret_access_key=secret)
  
      create_bucket(TRANSIENT_BUCKET_NAME, s3)
  
  
  def create_bucket(name, s3):
      try:
          bucket = s3.create_bucket(Bucket=name)
      except ClientError as ce:
          print('error', ce)
  
  
  if __name__ == '__main__':
      main()
  </code></pre>