0 votes
1 view
in AWS by (18.7k points)

Everything with my code works. The only pitfall I am currently facing is that I cannot specify the folder within the S3 bucket that I would like to place my file in. Here is what I have:

s3.meta.client.upload_file('/tmp/'+filename, '<bucket-name>', filename)

I have tried both:

s3.meta.client.upload_file('/tmp/'+filename, '<bucket-name>/folder/', filename)

and:

s3.meta.client.upload_file('/tmp/'+filename, '<bucket-name>', '/folder/'+filename)

if anyone has any tips on how to direct this to a specific folder (if this is possible) please let me know!

1 Answer

0 votes
by (43.5k points)

There is no need to pass the absolute path as a Key value.

upload_file('/tmp/' + filename, '<bucket-name>', 'folder/{}'.format(filename))

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 23, 2019 in AWS by yuvraj (18.7k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...