AWS CLI put-bucket-recryption命令失败,验证错误的验证错误

发布于 2025-02-10 22:55:58 字数 1434 浏览 1 评论 0原文

我想在AWS S3存储桶上启用SSE-KMS加密,并将现有的KMS密钥应用于存储桶,还希望将bucke键将其设置为 true

aws cli put-bucket-recryption v2 doc:

https://awscli.amazonaws.com/v2/documentation/api/latest/latest/reference/s3api/put-bucket-encryptimption.html对于put-bucket-recryption and conter command,但获得了bucketKeyEnabled param的验证错误。 如果我删除该参数,则命令运行正常并正确设置KMS密钥。 但是,我还想将bucke键设置为 true

我的命令怎么了?我确实比较了AWS CLI版本V1和V2文档,并且在put-bucket-recryption上看起来都相同。 这是AWS CLI版本

命令:

aws s3api put-bucket-encryption \
    --bucket my-bucket \
    --server-side-encryption-configuration '{"Rules":[{"ApplyServerSideEncryptionByDefault":{"SSEAlgorithm":"aws:kms","KMSMasterKeyID":"AWS_KMS_key_ARN"},"BucketKeyEnabled":true}]}'

错误:

参数验证失败:未知参数 serversideCencryptionConfiguration.rules [0]:“ bucketKeyEnabled”,必须 是:applyServerSideCencryptionbyDefault

以下是我的AWS CLI版本信息:

$ aws --version
aws-cli/1.16.306 Python/2.7.16 Darwin/20.5.0 botocore/1.13.42

根据文档应该,但是此版本不支持buckeTKeyEnabled param?更新到最新的AWS CLI版本会有所帮助吗?

I want to enable SSE-KMS encryption on AWS S3 bucket and apply an existing KMS key to the bucket and also want to set the Bucket Key to true.

AWS CLI put-bucket-encryption v2 doc: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/put-bucket-encryption.html

I followed the above mentioned aws cli documentation for put-bucket-encryption and ran following command but got the validation error for BucketKeyEnabled param.
If I remove that param then the command runs fine and sets the KMS key correctly.
However, I also want to set the Bucket Key to true.

What's wrong with my command? I did compare the AWS CLI version v1 and v2 documentation and both looks same for put-bucket-encryption.
Is this an aws cli version

Command:

aws s3api put-bucket-encryption \
    --bucket my-bucket \
    --server-side-encryption-configuration '{"Rules":[{"ApplyServerSideEncryptionByDefault":{"SSEAlgorithm":"aws:kms","KMSMasterKeyID":"AWS_KMS_key_ARN"},"BucketKeyEnabled":true}]}'

Error:

Parameter validation failed: Unknown parameter in
ServerSideEncryptionConfiguration.Rules[0]: "BucketKeyEnabled", must
be one of: ApplyServerSideEncryptionByDefault

Following is my aws cli version info:

$ aws --version
aws-cli/1.16.306 Python/2.7.16 Darwin/20.5.0 botocore/1.13.42

As per documentation it should, but does this version not support BucketKeyEnabled param? would updating to the latest aws cli version help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的他你的她 2025-02-17 22:55:58

版本aws-cli/1.16.306非常旧的bucketKeyEnabled在旧版本中不支持。如果要继续使用CLI的V1,请使用1.24.7的最新版本。否则,更改为当前版本2.7.11

Version aws-cli/1.16.306 is very old, and BucketKeyEnabled is not supported in the old version. If you want to keep using v1 of CLI, use the latest version which is 1.24.7. Otherwise change to the current version 2.7.11.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文