I have this piece of code:
const AWS = require('aws-sdk');
async function getAWSKeys(){
  AWS.config.update({ region: 'us-west-2' });
  const SSM = new AWS.SSM();
  
  let ssAccessKeyPath = '/ss/s3/aws_access_key_id';
  let ssSecretKeyPath = '/ss/s3/aws_secret_access_key';
  
  console.log('before');
  const params = await SSM.getParameters({Names: [ssSecretKeyPath, ssAccessKeyPath], WithDecryption: true}).promise();
  console.log('after');
  return params;
}
var parameters = getAWSKeys();
console.log('1');
console.log('2');
console.log('3');
console.log(parameters);
When I run node index.js The log console shows:
before
1
2
3
Promise { <pending> }
after
My function getAWSKeys is async, and I'm using await for the call to SSM.getParameters. I really expect:
before
after
1
2
3
'my params'
Why execution doesn't wait for SSM.getParameters?
 
    