ok, I saw some examples of this, and here is my code in AWS Lambda Python 3.6:
import boto3
tmp = open('/tmp/' + name_str,"rb")
s3_client = boto3.resource('s3')
bucket = s3_client.Bucket(S3BUCKETNAME)
bucket.put_object(Key=name_str, Body=tmp, ContentType='text/csv', ContentEncoding='utf-8')
The error I get is:
An object's3.ServiceResource' does not have the attribute 'put_object': AttributeError
Well then I try:
s3_client.upload_file('/tmp/' + name_str, S3BUCKETNAME, name_str)
An object's3.ServiceResource' does not have the attribute 'upload_file': AttributeError
So ... I have to miss something basic ... Is there any other import? Why can't the system find these features?
source
share