in src/tokenizer/ddb_encrypt_item.py [0:0]
def encrypt_item (plaintext_item,table_name):
table = boto3.resource('dynamodb').Table(table_name)
aws_kms_cmp = AwsKmsCryptographicMaterialsProvider(key_id=aws_cmk_id)
actions = AttributeActions(
default_action=CryptoAction.ENCRYPT_AND_SIGN,
attribute_actions={'Account_Id': CryptoAction.DO_NOTHING}
)
encrypted_table = EncryptedTable(
table=table,
materials_provider=aws_kms_cmp,
attribute_actions=actions
)
#print (plaintext_item)
response = encrypted_table.put_item(Item=plaintext_item)
print(response)
return response