in lambda/importImageStatus/index.js [78:105]
function importStatusLinux(paramsSSM){
return new Promise(function(resolve, reject) {
let ec2 = new AWS.EC2({
region: paramsSSM.govRegion,
accessKeyId: paramsSSM.accessKey,
secretAccessKey: paramsSSM.secretKey
});
var params = {
ImportTaskIds: [
paramsSSM.importTaskId
],
};
ec2.describeImportSnapshotTasks(params, function(err, data) {
if (err) {
console.log(err);
reject(err);
} else {
//Grab the Snapshot Id so we can register the AMI Image
let status = data.ImportSnapshotTasks[0].SnapshotTaskDetail.Status;
if (status == "completed"){
paramsSSM.snapshotId = data.ImportSnapshotTasks[0].SnapshotTaskDetail.SnapshotId;
resolve(status);
}
resolve(status);
}
});
});
}