I have an S3 bucket named gisat.. there is a folder named micro inside the bucket where I want the text file to be uploaded from my local machine. I'm running this using Pycharm. I don't know what the error is. Kinda new to boto3.
Here's the code:
import boto3
def lambda_handler(event, context):
s3_resource = boto3.resource('s3')
mybucket = "gisat"
s3_resource.Bucket(mybucket).upload_file("C:/Users/Acer/Desktop/new.txt", "micro/new.txt")
This is the error I get:
"errorMessage": "[Errno 2] No such file or directory: 'C:/Users/Acer/Desktop/new.txt'"
The path I have given is correct. But I don't know what the issue is.
I haven't established a connection between the local code and the AWS account though. Not exactly sure how to do it. Is that what's causing the error? Please help