![]() ![]() We will use DistCp to copy sample data from S3 to HDFS and from HDFS to S3. The tutorial assumes no prior experience with AWS. To get an older version we need to specify the version id of the version we are trying to get.This is tutorial will help you get started accessing data stored on Amazon S3 from a cluster created through Hortonworks Data Cloud for AWS 1.16 (released in June 2017). ~]$ aws s3api get-object -bucket hirw-bucket-versions -key version-test -range bytes=0-10000 /dev/stdout | head When we get the object from S3, by default, S3 will return the most recent version. "VersionId": "8LKeiP26.7WS_CUYUmY_BNmpIX0ljIxa", ![]() ~]$ aws s3api list-object-versions -bucket hirw-bucket-versions You can see which version is latest by looking at the IsLatest property. ![]() When we now list-object-versions we will see 2 versions for the objects. We now change the content of the file version-test to – “Hello, this is VERSION TWO” "VersionId": "w6l8ijFxRK5JtEiwfcjeYYn5IGe8oTKp", Here we can see the key of the object which is the name of the file/object and the version id. Let’s now execute s3api list-object-versions with the name of the bucket. version-test to s3://hirw-bucket-versions/version-test We first upload a file named version-test with the following text – “Hello, this is VERSION 1” ~]$ aws s3 cp version-test s3://hirw-bucket-versions If your bucket is already created, go to properties and make sure versioning is enabled. Versioning can be enabled on a bucket during creation or after creation. In this post we are going to see how to enable version on a bucket and then how to get a very specific version of a file or object from S3 using AWS CLI. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |