如何将 Lambda 函数生成的密钥、值传递给 KMS

问题描述

我有以下打字稿代码可以生成我需要存储在 KMS 中的密钥

import {LocalCryptUtils} from 'crypt-util';

const fs = require('fs');

const cryptUtils = new LocalCryptUtils();
cryptUtils.createMasterPrivateKey();

var file = fs.createWriteStream('../../config/derived.txt')
file.write('{\n');
file.write(` "public_key_derived" : "${cryptUtils.derivePublicKey(0,0)}",\n`)
file.write(` "public_address_derived" : "${cryptUtils.deriveAddress(0,0)}" \n`)
file.end('}\n');

console.log(`{ "masterKey" : "${cryptUtils.exportMasterPrivateKey()}" }`);

我在互联网上找到的所有资源都解释了如何在 Lambda 函数中包含 KMS 或 Parameter Store 变量。但我的要求是相反的。我需要使用 Lambda 函数生成密钥并存储在 KMS 中,并使用另一个较小的函数生成密钥并存储在 Parameter Store 中。因此,请在 ECS Fargate 中使用它。

非常感谢您的指导。

附注。我使用 terraform 作为 IaC 工具。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)