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?

Justin
已提问 2 年前1008 查看次数
1 回答
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.

profile picture
joahna
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则