58
55

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWSのEC2にmacからSSHする方法

Last updated at Posted at 2019-05-12

AWSのEC2へSSH接続したい時があったのでまとめます。

#1.キーペアの作成

AWSコンソールのEC2を選択し、キーペアをクリックします。
キーペア画面が開かれるのでキーペアの作成を押すと秘密鍵(pem)がダウンロードされます。

キーペア___EC2_Management_Console.png

#2.秘密鍵ファイルの移動と権限設定
ダウンロードしたファイルを~/.ssh以下に移動し、権限変更します

mv /Users/username/Downloads/web_app.pem  ~/.ssh
chmod 600 /Users/username/.ssh/○○.pem

#3.terminalからssh接続を行う
amazon linuxのEC2の初期ユーザ名は[ec2-user]です。

ssh -i /Users/username/.ssh/○○.pem ec2-user@ec2のグローバルIP

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

https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
15 package(s) needed for security, out of 22 available
Run "sudo yum update" to apply all updates.
[ec2-user@ip-10-0-0-54 ~]$

以上です。

58
55
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
58
55

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?