title: Nodejs async issue while decrypting aws kms keys
body: <p>I have a lambda function in node6 which has 5 env variables all encrypted with aws kms. I have the following method which takes a encrypted key and returns a decrypted key.</p>
  
  <pre><code>function decryptKMS(encryptedKey) {
  console.log('inside decryptkms');
   const kms = new AWS.KMS();
      kms.decrypt({ CiphertextBlob: new Buffer(encryptedKey, 'base64') }, (err, data) =&gt; {
          if (err) {
              console.log('Decrypt error:', err);
              return callback(err);
          }
          var result = data.Plaintext.toString('ascii');
          return result;
  });
  }
  </code></pre>
  
  <p>And in my handler I'm doing this to get my decrypted keys.</p>
  
  <pre><code>decryptedkey1 = decryptKMS(encryptedkey1);
  decryptedkey2 = decryptKMS(encryptedkey2);
  decryptedkey3 = decryptKMS(encryptedkey3);
  decryptedkey4 = decryptKMS(encryptedkey4);
  decryptedkey5 = decryptKMS(encryptedkey5);
  </code></pre>
  
  <p>But, since node is async, the function moved to the next step before decrypting the keys. Is there anyway I can use node promises for all the keys combined, or is there any way to decrypt multiple keys at once from kms?</p>