My development environment is a Windows machine. When trying to download a file from S3 locally it works no problem. When I load the function to Lambda, however, I receive a FileNotFoundError
error which is caused by the Lambda requiring a leading slash in the file key.
This works locally, but does not on Lambda...
s3 = boto3.resource('s3')
new_file_key = os.path.join('tmp', file_name)
s3.Bucket('bucketname').download_file(file_key, new_file_key)
This works on Lambda, but not locally...
s3 = boto3.resource('s3')
new_file_key = os.path.join('/tmp', file_name)
s3.Bucket('bucketname').download_file(file_key, new_file_key)
What's the simplest way to handle this?