Amzon Elastic Cloud Compute EC2及S3使用總結

來源:互聯網
上載者:User
由於客戶要求,要將我們的專案遷到時下American流行的雲計算,於是不得以開始對Amazon Elastic Cloud Compute的瞭解.


今天終於完成了專案遷入雲計算的Demo,閒話不說,先把這段時間使用的思路整理一下.


一.幾個比較重要的概念


1. EC2全稱Amazon Elastic Compute Cloud,是Amazon于2006年推出的新一代hosting服務.


2. Amazon Machine Image (AMI) - An Amazon Machine Image (AMI) is an encrypted file stored in Amazon S3. It contains all the information necessary to boot instances of your software. 一種儲存在Amazon S3上的加密檔(這裡我理解為鏡像吧),裡面包含了啟動你的應用軟體時所必須的所有資訊。


3. Instance - The running system based on an AMI is referred to as an instance. All instances based on the same AMI begin executing identically. Any information on them is lost when the instances are terminated or if they fail.實例是指基於AMI上運行的系統。


4. S3 - Amazon Simple Storage Service:Amazon Simple Storage Service provides a fully redundant data storage infrastructure fo r storing and retrieving any amount of data, at any time, from anywhere on the Web.





一. 準備工作


1.當然是申請一個AWS帳號了, AWS的全稱是Amazon Web Service.


2.申請完了再選擇自己需要的一些Service服務,進行註冊登錄,由於我們作伺服器使用,因些申請了EC2和S3,申請完以後注意裡面的一些收費專案.


3.註冊完後,在準備使用EC2的電腦配置JAVA Runtime環境.


4. 下載Amazon EC2 command-line tools from: HTTP://developer.amazonwebservices.com/connect/entry.jspa?externalID=351& categoryID=88 "Resource Center"->」Amazon Elastic Compute Cloud (Beta) 「->"Developer Tools". 或者下載安裝Firefox的Elasticfox外掛程式及S3 Organizer外掛程式, 本文使用Firefox外掛程式來管理EC2及S3.





二. EC2使用.


1. 通過Elasticfox介面的Account IDs,錄入Account ID及Display Name, Account ID在登錄AWS的active acount可以看到


2. 現在可以在Credentials的下拉清單選擇剛錄入的Display Name.


3. 在KeyPairs建立一個新的keypair, 用於啟動AMI


4. 在Security Group建立消費者群, 在這個群裡建立Instance的存取權限,比如埠啊,訪問者的網段啊等等, 這些也是用於啟動AMI時用到.


5 現在回到Machine Images中可以看到一些公用的可選擇的Instance, 選擇一個適全的Instance, launch it, 在啟動介面中選擇keypairs和security group.


6. Launch it後,登錄instance進行一些配置操作, 然後登出將其bundle into AMI.


7. 在bundle task完成後,選擇complete的task右鍵選擇register a new AMI.


8, Register 完成後會回到Machine Images這個Tag, 你可看到這個AMI綁定了你的Account ID, 並且Visibility欄位變成了private, 說明bundle成功.


9. 這其中還有兩個有用的操作, 一個是Elastic IP,用來給你的AMI綁定一個固定的IP,另一個是EBS Volumes, 用來擴展硬碟空間,及存儲持久的資料.





三. S3使用


1. 通過S3 Organizer介面的Manage Accounts錄入自己的Account Name, Access Key和Secret Key, 其中Account Name可以自己定義, Access Key和Secret Key則是在登 錄AWS的Access Identifers可以看到.


2. 剩下的工作就比較簡單了,通過在S3上建立自己的資料夾, 設置資料夾的ACL(使用者許可權), 就可以開始檔的上傳下載了, 這裡要說明的是設置ACL後好像不會立即生效, 所以設好後沒有馬上產生作用不要覺得奇怪,過一會就好了.





這裡注意一下, instance的D盤是一個固定的快閃記憶體空間, 上面的資料不是持久資料, 如果你terminate這個instance時, D盤的資料也隨之消失, 不管你是否bundle它.所以如果要存持久資料的話要麼存到S3上, 要麼attach一個EBS Volume, 然後將資料存在Volume上, 不過這樣的存儲都是需要收取I/O使用費的, :), 所以除非要備份Instance資料, 或是傳資料到伺服器上, 我才會用到S3和EBS Volume, 其它要用到的資料就到網上下.


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.