Error when creating S3 bucket using aws cli - Unknown options: --object-ownership, BucketOwnerEnforced
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?
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.
Relevant questions
Error when creating S3 bucket using aws cli - Unknown options: --object-ownership, BucketOwnerEnforced
asked a month agoHow do I create a role for AWS Batch using the CLI
asked 22 days agoCLI cp returns: ...GetObjectTagging...not implemented
asked 2 years agoAccess denied when trying to GET objects uploaded to s3 bucket via aws sdk using cloudfront
asked 6 months agoError When I create a Bucket Policy Why?
asked a year agoS3 bucket stuck in an error state
asked 2 years agoVirtual hosting an S3 bucket using Cloudfront + SSL
asked 3 years agoSAM CLI Deployment error creating S3 Bucket
Accepted Answerasked 8 months agoAWS Cli Error
Accepted Answerasked 3 years agoUnknown options: s3:// error on using CP
asked 2 years ago