Reputation: 648
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
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