LoginSignup
2
1

More than 1 year has passed since last update.

EC2にログインする

Posted at

はじめに

環境構築ため、EC2へSSH接続しようとするも、忘れていたため記事にしておきます。

前提

・ EC2インスタンスを作成済
・ セキュリティグループのインバウンドルールでSSH接続を許可
・ .sshフォルダにpemキーが存在すること
・ EC2インスタンスにパブリックIPv4アドレスまたはElasticIPアドレスがあること

手順

① EC2のパブリックIPアドレスをコピー
スクリーンショット (52)_LI.jpg

スクリーンショット (53)_LI.jpg
② キーをIPアドレスを指定してコマンドを入力

$ ssh -i ~/.ssh/key-pair-01.pem ec2-user@3.112.171.244

間違いがなければ

The authenticity of host '3.112.171.244 (3.112.171.244)' can't be established.
ECDSA key fingerprint is SHA256:C5a+u1etiJqjUZpDOBctxaO2gCxeg5HuKw6BeenXL1k.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

と出てくるので、

yes

と入力すると

Warning: Permanently added '3.112.171.244' (ECDSA) to the list of known hosts.

       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-2/

と出てきて、接続完了です。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1