Put an object from a remote resource in Amazon S3

I am trying to find a way to put an object that is somewhere on the Internet in Amazon S3 without loading it first and then loading it on S3. Is this possible in principle?

I am using the Node.js SDK. Ideally, I want to do something like this:

s3.client.putObject({ Bucket: 'my-own-bucket', Key: 'myKey', BodyFromRemoteRecource: 'https://www.google.com/images/srpr/logo4w.png' }, function(err, data) { if (err) console.log(err) else console.log("Successfully uploaded data to myBucket/myKey"); }); 
+2
source share
2 answers

You can do this if the source is somewhere on S3 already, but not for other resources. So no, you cannot do what your use case asks.

You can move data from the URL to S3 without fully downloading it one step before downloading if that helps. Each byte will still have to go through some kind of machine, but you can RECEIVE and then POP it with a piece at a time.

The entire S3 API is registered here , and you can check each operation and see that nothing will be done.

+4
source

Something like this works for me with the PHP2 SDK:

 $aws_transfer = $s3->PutObject( array( 'Bucket' => 'bucket', 'Key' => $unique_file_name, 'Body' => \Guzzle\Http\EntityBody::factory( file_get_contents('http://www.example.com/file.flv') ), ) ); 
+1
source

All Articles