我正在尝试使用boto3和put_bucket_encryption()
函数在S3存储桶上启用加密。但是,我似乎收到以下错误:
[ERROR] TypeError: expected string or bytes-like object
特别是它在抱怨这一行:
'SSEAlgorithm': 'AES256'
下面是我的代码:
s3_client = boto3.client('s3', region_name='us-east-1')
s3_client.put_bucket_encryption(
Bucket=bucket,
ServerSideEncryptionConfiguration={
'Rules':[
{
'ApplyServerSideEncryptionByDefault': {
'SSEAlgorithm': 'AES256'
}
}
]
}
)
我尝试将整个对象转换为字符串以及它抱怨的那一行,但是无济于事。任何帮助表示赞赏。