Liz's Blog

Amazon Web Services (AWS)#2:Amazon Elastic Compute Cloud (EC2) 啟動Linux虛擬機器

| Comments

最近在測試Amazon AWS免費方案的幾項服務,逐步紀錄一下學習的步驟。本文是建立Amazon EC2免費用量的Linux虛擬機器,Amazon已經很大心翻譯成中文啦!

1.於Amazon Web Services註冊會員(有使用過Amazon買書服務的人,則用原本帳密登入即可)

2.[Services]->[Compute]->[EC2]

3.點選Create Instance下的[Launch Instances]
->啟動 Amazon EC2 執行個體

4.點選Amazon Linux AMI旁的[Select]

5.點選預設Free tier eligible的[t2.micro],接著點選[Review and Launch]

6.若沒有要修改執行個體預設值,直接按[Launch]

[Mac Only]其他系統請看這裡
7.畫面會出現Select an existing key pair or create a new key pair,選擇[Create a new key pair],Key pair name填寫MyFirstKey,接著按下[Download Key Pair]

8.下載的檔案要改成.pem檔案,放到.ssh資料夾下
如何找到.ssh資料夾,隨便開的資料夾後, command+shift+G 即可找到.ssh資料夾

9.放好後,按下[Launch Instances]

10.[View Instances]

11.記錄公有IP位址,之後會用到

12.打開終端機,輸入 chmod 400 ~/.ssh/MyFirstKey.pem
->限制私有SSH金鑰的許可

13.輸入 ssh -i ~/.ssh/MyFirstKey.pem ec2-user@{公有IP}

14.看到以下類似訊息,輸入yes
The authenticity of host 'ec2-198-51-100-1.compute-1.amazonaws.com (10.254.142.33)' can't be established.RSA key fingerprint is 1f:51:ae:28:df:63:e9:d8:cf:38:5d:87:2d:7b:b8:ca:9f:f5:b1:6f. Are you sure you want to continue connecting (yes/no)?

15.回應會出現類似以下訊息後,出現EC2 Amazon Linux AMI歡迎畫面:
Warning: Permanently added 'ec2-198-51-100-1.compute-1.amazonaws.com' (RSA) to the list of known hosts.

16.若要終止執行個體,回到EC2主控台,選擇[Actions]->[Instance State]->[Terminate]
試用期是首次啟動AWS服務後一年,所以不要用就趕快停掉囉!

17.系統會再次詢問是否終止Instances,選擇[Yes. Terminate]即可。

【延伸閱讀】

  1. Amazon Web Services (AWS)#1:Amazon S3雲端儲存服務申請
  2. Amazon Web Services (AWS)#2:Amazon Elastic Compute Cloud (EC2) 啟動Linux虛擬機器
  3. Amazon Web Services (AWS)#3:透過Elastic Beanstalk將Rails專案部署至AWS上

Comments

comments powered by Disqus