**AWS error "An error occurred (InvalidRequest) when calling the CreateBucket operation: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256."**

To fix this error, you need to use “signature_version=’s3v4’”.  This code works fine :)

#!/usr/bin/env python
import boto3.session
from botocore.client import Config
import logging

session = boto3.session.Session()

s3_client = session.client('s3',
            region_name='eu-central-1',
            endpoint_url='http://s3-eu-central-1.amazonaws.com',
            config=Config(signature_version='s3v4'))

bucket_name = 'milesd-002'

aws_region = 'eu-central-1'

try:
    response = s3_client.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={'LocationConstraint': aws_region})
except Exception as e:
    logging.warn("Unable to setup version on *%s* - %s", bucket_name, e)