VK Cloud logo

Access Control Lists

Getting a bucket ACL

  1. Set up AWS CLI, if not done earlier.

  2. Run the command in the console:

    aws s3api get-bucket-acl --bucket <BUCKET_NAME> --endpoint-url <ENDPOINT_URL>

    Here:

    • <BUCKET_NAME> — the name of the bucket whose ACL you want to retrieve.

    • <ENDPOINT_URL> — must match the account region:

      • https://hb.vkcloud-storage.ru or https://hb.ru-msk.vkcloud-storage.ru — for the Moscow region;
      • https://hb.kz-ast.vkcloud-storage.ru — for the Kazakhstan region.

    Full information about the get-bucket-acl command is available on the developer website.

Getting an object ACL

  1. Install and set up AWS CLI, if not installed yet.

  2. Run the command in the console:

    aws s3api get-object-acl --bucket <BUCKET_NAME> --key <OBJECT_KEY> --endpoint-url <ENDPOINT_URL>

    Here:

    • <BUCKET_NAME> — the name of the bucket for which you want to set the ACL.

    • <OBJECT_KEY> — the full name of the object, including the path to it.

    • <ENDPOINT_URL> — must match the account region:

      • https://hb.vkcloud-storage.ru or https://hb.ru-msk.vkcloud-storage.ru — for the Moscow region;
      • https://hb.kz-ast.vkcloud-storage.ru — for the Kazakhstan region.

    Full information about the get-object-acl command is available on the developer website.

Setting an ACL for a bucket

Setting an ACL configuration for a bucket

  1. Install and set up AWS CLI, if not installed yet.

  2. Prepare a file with the ACL configuration.

  3. Run the command in the console:

    aws s3api put-bucket-acl --bucket <BUCKET_NAME>  --access-control-policy file://<FILE_NAME>.json --endpoint-url <ENDPOINT_URL>

    Here:

    • <BUCKET_NAME> — the name of the bucket for which you want to set the ACL.

    • <FILE_NAME> — the name of the file with the ACL configuration.

    • <ENDPOINT_URL> — must match the account region:

      • https://hb.vkcloud-storage.ru or https://hb.ru-msk.vkcloud-storage.ru — for the Moscow region;
      • https://hb.kz-ast.vkcloud-storage.ru — for the Kazakhstan region.

    Full information about the put-bucket-acl command is available on the developer website.

Setting a predefined ACL for a bucket

  1. Install and set up AWS CLI, if not installed yet.

  2. Run the command:

    aws s3api put-bucket-acl \    --bucket <BUCKET_NAME> \    --acl <PREDEFINED_ACL> \    --endpoint-url <ENDPOINT_URL>

    Here:

    • <BUCKET_NAME> — the name of the bucket for which you want to set the ACL.

    • <PREDEFINED_ACL> — the name of the standard ACL to be set for the bucket.

    • <ENDPOINT_URL> — must match the account region:

      • https://hb.vkcloud-storage.ru or https://hb.ru-msk.vkcloud-storage.ru — for the Moscow region;
      • https://hb.kz-ast.vkcloud-storage.ru — for the Kazakhstan region.

Setting individual ACL permissions for a bucket

  1. Install and set up AWS CLI, if not installed yet.

  2. Run the command:

    aws s3api put-bucket-acl \    --bucket <BUCKET_NAME> \    --<PERMISSION_TYPE> <PERMISSION_GRANTEE> \    --endpoint-url <ENDPOINT_URL>

    Here:

    • <BUCKET_NAME> — the name of the bucket for which you want to set the ACL.

    • <PERMISSION_TYPE> — can be one of the following:

      • --grant-read — the READ permission will be set for the bucket.
      • --grant-write — the WRITE permission will be set for the bucket.
      • --grant-read-acp — the READ_ACP permission will be set for the bucket.
      • --grant-write-acp — the WRITE_ACP permission will be set for the bucket.
      • --grant-full-control — the FULL_CONTROL permission will be set for the bucket.
    • <PERMISSION_GRANTEE> — the grantee who will be granted the permission for the bucket.

    • <ENDPOINT_URL> — must match the account region:

      • https://hb.vkcloud-storage.ru or https://hb.ru-msk.vkcloud-storage.ru — for the Moscow region;
      • https://hb.kz-ast.vkcloud-storage.ru — for the Kazakhstan region.

Setting an ACL for an object

Setting an ACL configuration for an object

  1. Install and set up AWS CLI, if not installed yet.

  2. Prepare a file with the ACL configuration.

  3. Run the command in the console:

    aws s3api put-object-acl --bucket <BUCKET_NAME> --key <OBJECT_KEY> --access-control-policy file://<FILE_NAME>.json --endpoint-url <ENDPOINT_URL>

    Here:

    • <BUCKET_NAME> — the name of the bucket where the object is located.

    • <OBJECT_KEY> — the full name of the object for which you want to set the ACL, including the path to it.

    • <FILE_NAME> — the name of the file with the ACL configuration.

    • <ENDPOINT_URL> — must match the account region:

      • https://hb.vkcloud-storage.ru or https://hb.ru-msk.vkcloud-storage.ru — for the Moscow region;
      • https://hb.kz-ast.vkcloud-storage.ru — for the Kazakhstan region.

    Full information about the put-object-acl command is available on the developer website.

Setting a predefined ACL for an object

  1. Install and set up AWS CLI, if not installed yet.

  2. Run the command:

    aws s3api put-object-acl \  --bucket <BUCKET_NAME> \  --key <OBJECT_KEY> \  --acl <PREDEFINED_ACL> \  --endpoint-url <ENDPOINT_URL>

    Here:

    • <BUCKET_NAME> — the name of the bucket where the object is located.

    • <OBJECT_KEY> — the full name of the object for which you want to set the ACL, including the path to it.

    • <PREDEFINED_ACL> — the name of the standard ACL to be set for the object.

    • <ENDPOINT_URL> — must match the account region:

      • https://hb.vkcloud-storage.ru or https://hb.ru-msk.vkcloud-storage.ru — for the Moscow region;
      • https://hb.kz-ast.vkcloud-storage.ru — for the Kazakhstan region.

Setting individual ACL permissions for an object

  1. Install and set up AWS CLI, if not installed yet.

  2. Run the command:

    aws s3api put-object-acl \  --endpoint-url <ENDPOINT_URL> \  --bucket <BUCKET_NAME> \  --key <OBJECT_KEY> \  <PERMISSION_TYPE> <PERMISSION_GRANTEE>

    Here:

    • <BUCKET_NAME> — the name of the bucket where the object is located.

    • <OBJECT_KEY> — the full name of the object for which you want to set the ACL, including the path to it.

    • <PERMISSION_TYPE> — can be one of the following:

      • --grant-read — the READ permission will be set for the object.
      • --grant-write — the WRITE permission will be set for the object.
      • --grant-read-acp — the READ_ACP permission will be set for the object.
      • --grant-write-acp — the WRITE_ACP permission will be set for the object.
      • --grant-full-control — the FULL_CONTROL permission will be set for the object.
    • <PERMISSION_GRANTEE> — the grantee who will be granted the permission for the object.

    • <ENDPOINT_URL> — must match the account region:

      • https://hb.vkcloud-storage.ru or https://hb.ru-msk.vkcloud-storage.ru — for the Moscow region;
      • https://hb.kz-ast.vkcloud-storage.ru — for the Kazakhstan region.
Was this article helpful?