I am trying to generate a random key in a lambda using kms.generateRandom. I tried the sample mentioned in the document but it does not return anything. No error no Data. Has anybody used it? Do I have to grant any access to my lambda? Below is the code I'm trying
/* The following example uses AWS KMS to generate 32 bytes of random data. */
var params = {
NumberOfBytes: 32// The length of the random data, specified in number of bytes.
};
kms.generateRandom(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
Plaintext: <Binary String>// The random data.
}
*/
});