s3_upload.py
def upload_to_s3(bucket, artefact, bucket_key):
    """
    Uploads an artefact to Amazon S3
    """
    try:
        client = boto3.client('s3')
    except ClientError as err:
        print("Failed to create boto3 client.\n" + str(err))
        return False
    try:
        client.put_object(
            Body=open(artefact, 'rb'),
            Bucket=bucket,
            Key=bucket_key
        )
    except ClientError as err:
        print("Failed to upload artefact to S3.\n" + str(err))
        return False
    except IOError as err:
        print("Failed to access artefact in this directory.\n" + str(err))
        return False
    return True

    Uploads an artefact to Amazon S3
    
Uploads an artefact to Amazon S3
Uploads an artefact to Amazon S3
def upload_to_s3(bucket, artefact, bucket_key):
    try:
        client = boto3.client('s3')
    except ClientError as err:
        print("Failed to create boto3 client.\n" + str(err))
        return False
    try:
        client.put_object(
            Body=open(artefact, 'rb'),
            Bucket=bucket,
            Key=bucket_key
        )
    except ClientError as err:
        print("Failed to upload artefact to S3.\n" + str(err))
        return False
    except IOError as err:
        print("Failed to access artefact in this directory.\n" + str(err))
        return False
    return True
def upload_to_s3 ( bucket , artefact , bucket_key ) : try : client = boto3 . client ( 's3' ) except ClientError as err : print ( "Failed to create boto3 client.\n" + str ( err ) ) return False try : client . put_object ( Body = open ( artefact , 'rb' ) , Bucket = bucket , Key = bucket_key ) except ClientError as err : print ( "Failed to upload artefact to S3.\n" + str ( err ) ) return False except IOError as err : print ( "Failed to access artefact in this directory.\n" + str ( err ) ) return False return True
Uploads an artefact to Amazon S3
Uploads an artefact to Amazon S3
"""
    Uploads an artefact to Amazon S3
    """
bucket
artefact
bucket_key