put-object-acl

Prev Next

Available in Classic and VPC

Configure the access control list (ACL) to be applied to an object.

Syntax

The put-object-acl syntax is as follows:

aws s3api put-object-acl \
    --bucket <bucket> \
    --key <key> \
    [--acl <acl>] \
    [--grant-read <grant-read>] \
    [--grant-write <grant-write>] \
    [--grant-full-control <grant-full-control>] \
    [--version-id <version-id>] \
    [--access-control-policy <access-control-policy>] \
    --endpoint-url <endpoint-url>

Options

This section describes the options available when running put-object-acl.

Required options

The following options are required for put-object-acl.

Options Type Required Description
--bucket String Required Bucket name
--key String Required Object name

Optional options

These are the optional options for put-object-acl. Options that are not specified will use their default values.

Options Type Required Description
--acl String Optional Predefined ACL to apply
  • private | public-read | public-read-write | authenticated-read
--grant-read String Optional Target to grant read permissions to
--grant-write String Optional Target to grant write permissions to
--grant-full-control String Optional Target to grant all permissions to
--version-id String Optional Object version ID
--access-control-policy String Optional ACL policy that directly specifies the grant list and owner
  • Enter in JSON format.

Common options

For information about the options common to all aws subcommands, see Object Storage options.

Examples

If the ACL configuration request is successful, the settings are applied, and no result is displayed.

Command

The following is an example command for setting an object to public.

aws s3api put-object-acl --bucket my-test-bucket \
    --key img/image.png \
    --acl public-read \
    --endpoint-url=https://kr.object.ncloudstorage.com

The following is an example command for setting an object to private.

aws s3api put-object-acl --bucket my-test-bucket \
    --key img/image.png \
    --acl private \
    --endpoint-url=https://kr.object.ncloudstorage.com