EasyManua.ls Logo

CLOUDIAN HyperStore - Using the AWS CLI to Enable Object Lock; Test AWS CLI Setup and List Buckets; Create Bucket with Object Lock Enabled; Verify Object Lock Configuration

Default Icon
10 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
USING HYPERSTORE WITH OBJECT LOCK 9
USING THE AWS CLI TO ENABLE OBJECT LOCK
Once configured, the AWS CLI can be used to access HyperStore and create new buckets with Object
Lock enabled using the S3 API command set. The example that follows shows a few of many commands
that can be used to manage buckets and objects. A good introduction to using the S3 API with the AWS
CLI can be found here:
https://docs.aws.amazon.com/cli/latest/userguide/cli-services-s3-
apicommands.html. For a complete reference see: https://docs.aws.amazon.com/cli/latest/reference/s3api/
1. First test that the AWS CLI is set up properly by listing existing buckets for the user account
configured earlier. This user has 3 buckets.
$ aws s3 --endpoint-url=http://s3-reg01.cloudiantme.local ls
2019-11-15 16:23:46 b01
2019-11-15 16:29:09 b02
2019-11-15 16:32:26 b03
2. Create a new bucket with object lock enabled using the S3 API command set.
$ aws s3api create-bucket --bucket oblck01 --object-lock-enabled-for-bucket
--endpoint-url=http://s3-reg01.cloudiantme.local
{
"Location": "http://oblck01.s3-reg01.cloudiantme.local"
}
3. List the buckets to verify it was created properly. Note that oblck01 now appears in the list.
$ aws s3 --endpoint-url=http://s3-reg01.cloudiantme.local ls
2019-11-15 16:23:46 b01
2019-11-15 16:29:09 b02
2019-11-15 16:32:26 b03
2019-11-18 16:11:48 oblck01
4. Verify that Object Lock is enabled on the new bucket
$ aws s3api get-object-lock-configuration --bucket oblck01 --endpoint-
url=http://s3-reg01.cloudiantme.local
{
"ObjectLockConfiguration": {
"ObjectLockEnabled": "Enabled"
}
}
5. A JSON file can be used to set the Object Lock policy and default retention time for objects in the
bucket. The example JSON file sets the bucket to GOVERNANCE mode and a retention of 1 day.
$ aws s3api put-object-lock-configuration --bucket b02 --object-lock-
configuration file://object-lock-config-g-1day.json