downloading a file from Internet into S3 bucket

后端 未结 4 1785
無奈伤痛
無奈伤痛 2020-12-29 04:12

I would like to grab a file straight of the Internet and stick it into an S3 bucket to then copy it over to a PIG cluster. Due to the size of the file and my not so good int

4条回答
  •  北海茫月
    2020-12-29 04:45

    You can stream the file from internet to AWS S3 using Python.

    s3=boto3.resource('s3')
    http=urllib3.PoolManager()
    
    urllib.request.urlopen('')   #Provide URL
    s3.meta.client.upload_fileobj(http.request('GET', 'Internet_URL>', preload_content=False), s3Bucket, key, 
        ExtraArgs={'ServerSideEncryption':'aws:kms','SSEKMSKeyId':''})
    

提交回复
热议问题