通过node.js子进程连接到ec2

时间:2016-04-15 01:39:29

标签: node.js amazon-ec2

这就是我目前正在运行的:

const spawn = require('child_process').spawn;
const connect = spawn('ssh', ['-T', '-i', '/keys/key.pem', 'ec2-user@00.000.000.000']);

connect.stdout.on('data', function(data) {
    console.log(`stdout: ${data}`);
});
connect.stderr.on('data', (data) => {
    console.log(`stderr: ${data}`);
});
connect.on('close', (code) => {
    console.log(`child process exited with code ${code}`);
});

(我的IP地址实际上不是00.000.000.000)

我收到错误:

stderr: ssh: connect to host 00.000.000.000 port 22: Operation timed out

0 个答案:

没有答案