olekb
olekb

Reputation: 648

Is there "S3 range read function" that allows to read assigned byte range from AWS-S3 file?

Trying to process large file in AWS Lamba and skipping through the whole file seems a bit wasteful. Is there a "range read" function that allows to read only predefined byte range from S3 file?

Upvotes: 3

Views: 5017

Answers (1)

Chris Nauroth
Chris Nauroth

Reputation: 9844

Yes, this is possible. According to S3 documentation of GET Object in the REST API, it supports use of the HTTP Range header.

Range

Downloads the specified range bytes of an object. For more information about the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.

In the example syntax:

GET /ObjectName HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version 4))
Range:bytes=byte_range

Popular S3 client libraries, such as the AWS SDK for Java provide convenient client-side APIs for specifying the range information.

Upvotes: 4

Related Questions