title: Use pickled files stored on S3 in AWS Lambda
body: <p>I'm currently working on an Amazon Web Services Lambda function, where I need to utilize sklearn files that I've created locally but are now stored in S3. I've been stumped on how to actually do this, I've tried a few different methods from boto3's docs but this results in a timeout error:</p>
  
  <pre><code>import boto3
  import pickle
  s3 = boto3.client("s3", region_name="us-west-1")
  response = s3.get_object(Bucket="mybucket", Key="bin_files/scaler.pkl")
  loaded_file = pickle.load(response["Body"])
  </code></pre>
  
  <p>While doing this on the other hand results in a file not found error:</p>
  
  <pre><code> with open(key, 'wb') as data:
       s3.Bucket(event['bucket']).download_fileobj(key, data)
  
  
  "errorMessage": "[Errno 2] No such file or directory: 
  'bin_files/scaler.pkl'"
  </code></pre>
  
  <p>Does anyone have any thoughts or tips on how to do this? </p>