如何从s3服务器端加密客户提供的密钥转录

时间:2020-08-14 06:10:36

标签: amazon-s3 encryption boto3 amazon-iam aws-transcribe

我在我的flask应用程序中使用boto3,以通过服务器端加密客户提供的密钥将文件上传到s3存储桶中。 我从加密的s3文件尝试了start_transcription_job,但是我有一个例外

s3_client.upload_file(filename, BUCKET, s3filename, ExtraArgs={'SSECustomerKey': KEY, 'SSECustomerAlgorithm': 'AES256' })

transcribe_obj.start_transcription_job(
     TranscriptionJobName=job_name,
     Media={'MediaFileUri': s3uri},
     MediaFormat=file_extension,
     LanguageCode='en-US'
)

例外:

botocore.errorfactory.BadRequestException: An error occurred (BadRequestException) when calling the StartTranscriptionJob operation: The S3 URI that you provided can't be accessed. Make sure your URI is valid and try your request again.

1 个答案:

答案 0 :(得分:0)

来自Protecting data using server-side encryption with customer-provided encryption keys (SSE-C) - Amazon Simple Storage Service

您可以管理用于加密哪个对象的加密密钥的映射。 Amazon S3不存储加密密钥。您负责跟踪为哪个对象提供的加密密钥。

我认为问题是该对象已使用AWS不存储的密钥加密。因此,当AWS Transcribe尝试读取对象时,它无法解密内容。

似乎没有办法将密钥传递给start_transcription_job()

您将需要使用另一种加密方法,使AWS能够解密该对象。