我的 aws 帐户位于 us-west-2 区域。并且在该账户中创建的 KMS 密钥具有 ARN arn:aws:kms:us-east-1::key/。在我的节点模块中,我使用 Credstash 解密使用 KMS 密钥加密的密钥。
var credstash = new Credstash({ 'table': 'tablename', 'awsOpts': { 'region':'region' } });
let secret = credstash.getSecret({name: 'keyname'}).then(result =>{
console.log(result);
});;
Run Code Online (Sandbox Code Playgroud)
我低于异常。
"The ciphertext refers to a customer master key that does not exist,
does not exist in this region, or you are not allowed to access"
Run Code Online (Sandbox Code Playgroud)
以下是 sls 文件中的 IAM 策略。
Effect: "Allow"
Action: ["kms:Decrypt"]
Resource: [
Fn::Join: ["", [ "arn:aws:kms:us-east-1:accountid:key/",{"Fn::Sub": "kmskey"}]]
]
Run Code Online (Sandbox Code Playgroud)
任何解决此问题的指针都会有很大帮助