Я пытаюсь S SH все экземпляры ec2 в AWS учетной записи с помощью лямбда-функции.
c .connect (hostname = each_in.private_ip_address, username = 'pcs_user', pkey = k)
Но я получаю такую ошибку. Я использовал AWSLambdaVPCAccessExecutionRole для роли IAM.
Response:
{
"errorMessage": "[Errno 110] Connection timed out",
"errorType": "TimeoutError",
"stackTrace": [
" File \"/var/task/lambda_function.py\", line 30, in lambda_handler\n c.connect( hostname = each_in.private_ip_address, username = 'pcs_us', pkey = k )\n",
" File \"/opt/python/paramiko/client.py\", line 349, in connect\n retry_on_signal(lambda: sock.connect(addr))\n",
" File \"/opt/python/paramiko/util.py\", line 283, in retry_on_signal\n return function()\n",
" File \"/opt/python/paramiko/client.py\", line 349, in <lambda>\n retry_on_signal(lambda: sock.connect(addr))\n"
]
}