'Download a file from internet to AWS S3 using AWS lambda with python code [closed]

I want to download a file from the internet to AWS S3 using AWS lambda with python code. How can I do it?



Solution 1:[1]

By using the Boto3 library, you can upload the file to your bucket after downloading it. Here is the boto3 function you need to use.

import boto3
s3 = boto3.resource('s3')
s3.meta.client.upload_file('/tmp/hello.txt', 'mybucket', 'hello.txt')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Glorfindel