云计算 频道

云计算实战:Amazon EC2之初体验

   【IT168 资讯】由于项目的需要,这几个月都在使用Amazon的EC2。这个东西对于国内的用户来说比较陌生,但是听国外的同事说,这在美国可是相当流行。这里简单介绍一下,大家有兴趣也可以试试。[本文转自Kiki zhao的博客:http://www.cnblogs.com/nckiki/]

什么是EC2

    EC2全称Amazon Elastic Compute Cloud,是Amazon于2006年推出的新一代hosting服务,目前尚处于beta阶段,但是使用中没有发现什么问题,相当稳定。EC2的功能介绍参见:http://www.amazon.com/gp/browse.html?node=201590011

    要用EC2,有两个概念必须先了解。

    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上的加密文件,里面包含了启动你的应用软件时所必须的所有信息。

    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上运行的系统。

从网上申请EC2服务

    对EC2有个大概了解之后,就可以开始在网上申请使用此项服务了。

    1. 首先必须先在Amazon Web Services上注册一个用户http://www.amazon.com/gp/browse.html?node=3435361
2. 注册完毕后,回到Amazon Web Services页面,点击左边Browse Web Services中的Amazon Elastic Compute Cloud (Beta),然后在EC2页面中,点击右边的Sign Up For This Web Service。这时系统会显示一个收费列表(如下)及要求你输入你的支付方式。

Instances
$0.10 per instance-hour consumed (or part of an hour consumed)
Data Transfer
$0.10 per GB - all data transfer in
$0.18 per GB - first 10 TB / month data transfer out
$0.16 per GB - next 40 TB / month data transfer out
$0.13 per GB - data transfer out / month over 50 TB

    可以看到EC2完全按你的需要收费。如果需要多个实例,就可以多开几个,不需要了就关了,没有传统hosting的固定合同。

    里面还提到Amazon的另一个服务Amazon Simple Storage Service ,简称Amazon S3,主要用于存贮数据。EC2是不负责储存的,每次instance关掉重启除/mnt外所有数据还原成VM镜像的初始状态,/mnt则被清空。储存由S3 (Amazon Simple Storage Service)服务负责。可以看看我的帐单。

    Instance基本硬件配置是是:Xen VM,2G CPU,1.7G RAM,文件系统Ext3: 10G /(镜像持久), 140G /mnt(每次重启被清空)。OS主要为Linux和Windows,可以从http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=101挑选自己需要的已经有的AMI。

    用户注册后,准备使用它了,这里有几项前提条件:

? 下载并安装最新的Java Runtime Environment from http://java.sun.com/javase/downloads/index_jdk5.jsp

? 下载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".

? 下载PuTTY & PuTTYgen from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
 

0
相关文章