By using AWS re:Post, you agree to the Terms of Use
/Error when creating S3 bucket using aws cli - Unknown options: --object-ownership, BucketOwnerEnforced/

Error when creating S3 bucket using aws cli - Unknown options: --object-ownership, BucketOwnerEnforced

0

Hey all,

I'm getting this error when trying to create an s3logging bucket using the aws cli following the instructions found here: https://docs.aws.amazon.com/cli/latest/reference/s3api/create-bucket.html:

aws s3api create-bucket \
    --bucket s3logs-us-east-1 \
    --region us-east-1 \
    --object-ownership BucketOwnerEnforced
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help


usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]

Unknown options: --object-ownership, BucketOwnerEnforced

This is pretty frustrating as I'm LITERALLY just copying and pasting the example found in the documentation and changing the s3 bucket name.

This is my aws cli version:

aws --version
aws-cli/1.19.1 Python/3.9.7 Linux/5.16.15-76051615-generic botocore/1.20.0

Any idea what's going wrong here?

1 Answers
0

I'm using CLI v2 and also getting the same error. Upon checking the help text for this command in CLI via aws s3api create-bucket help, the object-ownership option is not there (hence the error) even though the CLIv2 documentation has it as well (https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/create-bucket.html).

This could either be a documentation issue or an actual CLI bug. You may open an issue for this in github (https://github.com/aws/aws-cli/issues).

For the meantime you can create your s3logging bucket using the create-bucket CLI command but without the object-ownership option and then just issue another CLI command put-bucket-ownership-controls. More information here: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-ownership-existing-bucket.html.

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions