Unable to connect to instance via temporary key (generated by API)

0

Hi All,

I am unable to connect to instance with keys generated by API method GetInstanceAccessDetails (https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetInstanceAccessDetails.html).

From API side everything looks fine, request to GetInstanceAccessDetails returns proper information abount certificate key, ip address, private key and username. However when I try to connect to instance I get error from SSH.

I have also checked authorized_keys in instance and there is no information about key generated by GetInstanceAccessDetails method.

Anyone had similar problem?

質問済み 4年前220ビュー
2回答
0

The problem was not caused by time drift.
Problem was related to SSH keys. I did not realize that I need to use cert key also. So, thank you for that URL to SSH docs, based on this I was able to solve problem.

To anyone who have problem with temporary key from API ( https://docs.aws.amazon.com/cli/latest/reference/lightsail/get-instance-access-details.html )

  1. Save certKey in temp_id_rsa.pub
  2. Save privateKey in temp_id_rsa
  3. Connect to instance with SSH: ssh ubuntu@XXX.XXX.XXX.XXX -i temp_id_rsa
回答済み 4年前
  • @mariuszm I am still not able to connect. Getting 'Load key "temp_id_rsa": invalid format'.

0

There's a popular root cause for this: perhaps your instance system clock drifted too much.

SSH user certificates are time sensitive, in Lightsail they last few minutes only. If the clock on instance is wrong, they will never be usable.

Does Lightsail browser-based SSH work for you, @mariuszm?

To check, replace placeholders with the values that apply for you and visit the resulting URL:

https://lightsail.aws.amazon.com/ls/remote/YOUR_REGION/instances/YOUR_INSTANCE_NAME/terminal?protocol=ssh

See also:

AWS
モデレーター
回答済み 4年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ