Creating buckets

Create buckets using the AWS CLI.

The AWS CLI allows you to conveniently interact with your plusserver S3 resources via the command line. Follow the steps below to create buckets and enable Object Lock if necessary.

Creating a bucket

To create a bucket, use the following command:

aws s3api create-bucket --bucket <bucketname> --endpoint-url=https://<endpoint-url> --region <region> --create-bucket-configuration LocationConstraint=<region>

Replace <bucketname> with the desired name for your bucket and <endpoint-url> with the appropriate endpoint. For example, using de-west-1 it would be:

aws s3api create-bucket --bucket mynewbucket --endpoint-url=https://s3.de-west-1.psmanaged.com --region de-west-1 --create-bucket-configuration LocationConstraint=de-west-1

Creating a bucket when enabling Object Lock and Versioning

If you want to use Object Lock, you must enable both Versioning and Object Lock. To do this, use the following command:

The --object-lock-enabled-for-bucket parameter automatically enables versioning as well as Object Lock.

aws s3api create-bucket --bucket <bucketname> --object-lock-enabled-for-bucket --endpoint-url=https://<endpoint-url> --region <region> --create-bucket-configuration LocationConstraint=<region>

Replace <bucketname> and <endpoint-url> accordingly. For example:

aws s3api create-bucket --bucket mylockedbucket --object-lock-enabled-for-bucket --endpoint-url=https://s3.de-west-1.psmanaged.com --region de-west-1 --create-bucket-configuration LocationConstraint=de-west-1

Checking the settings of a bucket

Use the aws s3api get-bucket-versioning command to view the versioning settings of a bucket:

aws s3api get-bucket-versioning --bucket <bucketname> --endpoint-url=https://<endpoint-url>

This command indicates whether versioning is enabled for the specified bucket. Sample output:

{
    "Status": "Enabled"
}

To check the object lock settings, use the command aws s3api get-object-lock-configuration:

aws s3api get-object-lock-configuration --bucket <bucketname> --endpoint-url=https://<endpoint-url>

This command tells whether Object Lock is enabled for the specified bucket.

Sample output when object lock is enabled

{
  "ObjectLockConfiguration": {
    "ObjectLockEnabled": { "Enabled".
  }
}

Example output when object lock is not enabled

An error occurred (ObjectLockConfigurationNotFoundError) when calling the GetObjectLockConfiguration operation: Object Lock configuration does not exist for this bucket
Last modified 2023-10-26: Initial insertion of content. (87587ca)