Amazon上创建云服务器并绑定多IP

14 年 ago jony Amazon上创建云服务器并绑定多IP已关闭评论

 

1.首先在aws.amazon.com注册帐号,绑定信用卡

2.关于服务费,amazon每个月全收取100美元的技术服务费,在购买时要注意

登陆到:https://console.aws.amazon.com/console/home?region=us-west-2

要在一个EC2上绑定多个IP,必须创建VPC,因为一个EC2只能绑定一个IP,曾经为了这事折腾了N久

创建VPC:

在主控面板上选择VPC,或者:https://console.aws.amazon.com/vpc/home?region=us-west-2

1.选择:Create another VPC       所有设置默认就好,直接下一步,完在就行。这一步很简单,到此完成

2.在:Security Groups  ---inbound  开放相关端口,以后通过SSH连接服务器,或者访问http时会用到,其它按默认就好,以后都可以在EC2上操作

创建EC2

登陆到:https://console.aws.amazon.com/ec2/home?region=us-west-2#s=Home     或者在控制面板上选择EC2

1.选择服务器所在地区,各地区的收费不一样,如:Amazon EC2 (US West - Oregon)

2.开始创建 Launch Instance  ------Classic Wizard(默认)

3.选择操作系统类型,如果要绑定多IP,这里必须选择Amazon Linux AMI,至于多少位就看自己的需要,一般选择64位的,选择其它其它操作系统,99%增加不了网卡,也就是只能绑定上一个IP,其它IP绑定不上,曾经在这里折腾N久,严重BS下亚马逊,不能绑定上,也不会提示下,客户也不知道不能绑定上

4.Select-----到这里选择服务器的配制情况,相当于硬件的配制了。这里不同的配制是不一样的价格,貌似先了以后,不能自动升级,所以要考虑清楚,我选择M1 lagre   7.5G内存的,很贵,0.32美元/小时,坑哥

在:Launch Instances ----Launch into:   这里选择:VPC       要是选择了EC2,就白搞了,后面只能绑定上一个IP

当选择了VPC,下面会自动显示前面创建的VPC网络设置   Subnet:              点:下一步

5.

Number of Instances: 1 Availability Zone: No Preference

到这一步,这里不用去动,有些教程说这里要增加网络接口,也就是网卡,曾经我也增加过,结果系统直接启不来,这样反复折腾了几次,都一样,估计老版本是可以这样操作吧,这一页全按默认

6.

Storage Device Configuration

Your instance will be launched with the following storage device settings. Edit these settings to add EBS volumes, instance store volumes, or edit the settings of the root volume.

TypeDeviceSnapshot IDSizeVolume TypeIOPSDelete on Termination
Root/dev/sda1snap-921bb2b48GiBstandardtrue
这一步主要是增加硬盘空间或者说存储空间吧,这一步可以不管,创建好以后还可以去增加的,下一步
7.Add tags to your instance to simplify the administration of your EC2 infrastructure. A form of metadata, tags consist of a case-sensitive key/value pair, are stored in the cloud and are private to your account. You can create user-friendly names that help you organize, search, and browse your resources. For example, you could define a tag with key = Name and value = Webserver. You can add up to 10 unique keys to each instance along with an optional value for each key. For more information, go to Using Tags in the EC2 User Guide.

Key (127 characters maximum) Value (255 characters maximum) Remove
Remove Tag
Remove Tag
Add another Tag. (Maximum of 10)
到这里,在key   value都填上root,也可以不填,后期可以补上,我是写上:ROOT,下一步
8

Public/private key pairs allow you to securely connect to your instance after it launches. For Windows Server Instances, a Key Pair is required to set and deliver a secure encrypted password. For Linux Server Instances, a key pair will allow you to SSH into your instance.
To create a key pair, enter a name and click Create & Download your Key Pair. You will then be prompted to save the private key to your computer. Note, you only need to generate a key pair once - not each time you want to deploy an Amazon EC2 instance.
Choose from your existing Key Pairs
这里会叫你创建一个密钥,这个很管用,以后用SSH登陆时,就不用输密码了,直接用这个密钥
填个名字,然后下载到本地就OK
9.Choose one or more of your existing Security Groups
这里选择安全组,花样还很多,默认就好,如果你原来创建过,上面会有记录的,选择default的就好,所有的都选择这个,这样就都在同一个组了,下一步吧
10.Please review the information below, then click Launch.

AMI:  Amazon Linux AMI ID ami-2a31bf1a (x86_64)
Name: Amazon Linux AMI 2012.09
Description: The Amazon Linux AMI 2012.09 is an EBS-backed, PV-GRUB image. It includes Linux 3.2, AWS tools, and repository access to multiple versions of MySQL, PostgreSQL, Python, Ruby, and Tomcat. Edit AMI
 这一步,就是要你确认你的配置,没问题就下一步就行
11.

Your instances are now launching.
Instance ID(s): i-8f4dXXXX
到这里,意思就是创建成功了,直接点:Close就行
然后就可以在Instances     有个AMI正在安装,等几分钟就完成了,这个速度不错
接下来,就增加网卡了,默认只有一张网卡的
最下面找到:Network Interfaces
Name Network Interface ID Subnet ID VPC ID Zone Security Groups Description Owner ID Instance ID Status Public IP Primary Private IP Secondary Private IPs Private DNS Source/Dest. Check
empty
 eni-017ce168
subnet-5d6efc34
us-west-2b
default
Primary network interface
i-8f4d4xxx
in-use iconin-use
10.0.0.68
 打开就会看到上面这样的,私有IP已经给你分好了,为了好记,后面分配私有IP时,自己看着分配
1.点左上角:Create Network Interface        网卡增加正式开始
2.Description:   这里写你网卡的名字,随便你怎么写,自己方便就好,我写 2   第二个网卡
3.Subnet:   选择你的VPC的名字
4.Private IP   这里,输入你自己取的IP,为了好记,我输入:10.0.0.69,排起队来
5.Security Groups    这里选择有VPC default的组,VPC默认组
6.创建吧     到这里网卡就会显示出来,不过还不能用,下面。。。。。。。。
7.Attach    把网卡附加加Instance才能用
8.in-use      这样网卡就变颜色了,说明可以使用了
9,如果你还要增加网卡,方法都一样,依此类推
为了准确,可以通过SSh登陆到系统里面,用ifconfig -a查看,如果显示两个以上网卡,说明增加成功
至于怎么通过SSH连接上EC2,在另说明,这里不表态
分配IP                 增加了网卡,不分配IP,不是白搭?
1.Elastic IPs       点进去
2.Allocate New Address     这里要选择VPC,不要选择EC2,要不然只能绑定一个IP
3.Associate Address    把IP附给instance吧,要不然不知道把IP绑定给谁呀,附IP,并选择私有IP,这个很简单,分配不好,可以更改的,不影响什么
4.依此类推,这个很简单,想绑定多少个IP,加就是,听说IP是不要钱的,不知道具体怎么样,到时查查帐单
到这里绑定多IP就算完了,可以在instance下面看到,已经出现了三个网卡eth0  eht1  eth2
哪就通过SSH去使用了吧,这可是我折腾了N久总结出来的经验,可恶的亚马逊,客服很不给力,问了也是白问,我要退技术支持费用,100美元/月呢,坑哥