尝试使用Lambda/Boto3修改endpoint。
根据文档:
response = client.modify_endpoint(
EndpointArn='string',
S3Settings={
'EncryptionMode': 'sse-s3'|'sse-kms',
'ServerSideEncryptionKmsKeyId': 'string',
}
但是,当我设置“sse-kms”并传递我的KeyID时,我收到此错误:
[错误] ClientError:调用ModifyEndpoint操作时出错(invalidparametercomponentionexception ):仅支持SSE_S3加密模式。Traceback(最近一次调用last):File“/var/task/main . py”,第16行,in main response = client . modify _ endpoint(File“/var/runtime/boto core/client . py”,第316行,in _api_call返回self。_make_api_call(operation_name,kwargs)文件“/var/runtime/boto core/client . py”,第635行,in _make_api_call引发error_class(parsed_response,operation_name)
这是我的完整Lambda:
def main(event,context):
client = boto3.client('dms')
response = client.modify_endpoint(
EndpointArn = 'arn:aws:dms:us-east-1:123456789012:endpoint:xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
ExtraConnectionAttributes = 'cdcPath=undefined',
S3Settings = {
'CompressionType': 'none',
'DataFormat': 'parquet',
'EncryptionMode': 'sse-kms',
'ServerSideEncryptionKmsKeyId': 'arn:aws:kms:us-east-1:772631637424:key/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
}
)
看起来您已创建或现有endpointEncryptionMode设置为SSE_S3。根据本文件,您不可能将SSE_S3更改为SSE_KMS。
对于“修改终结点”操作,可以将“加密模式”参数的现有值从“SSE_KMS”更改为“SSE_S3”。但不能将现有值从SSE_S3更改为SSE_KMS。