【以下的问题经过翻译处理】 我想通过这段代码在我的Lambda函数中创建CloudFront预签名URL:
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
var AWS = require('aws-cloudfront-sign');
export const handler = async(event) => {
var signingParams = {
keypairId: "************************************",
privateKeyString: "****************************************",
privateKeyPath: '/path/to/private/key',
expireTime: 1426625464599
}
var signedUrl = AWS.getSignedUrl(
'http://example.cloudfront.net/path/to/s3/object',
signingParams
);
console.log(signedUrl);
};
我不知道发生了什么事情。
另一个问题,我有两个密钥“rsa xxxxxxx.pem”和“pk xxxxxxxxx.pem”。我将rsa.pem放在keypairid中,将pk.pem放在私钥字符串中,从字符串中删除了“-----END RSA PRIVATE KEY-----”和“-----BEGIN RSA PRIVATE KEY-----”。