Skip to main content

How to setup Amazon EC2 Instances in Amazon Cloud?

I. Register for Amazon EC2

1. Go to aws.amazon.com and make an account.

2. Read over all appropriate charges that you will incur. You'll be charged for bandwidth, disk io, the server itself, ebs volumes, etc. There is a free tier for new customers but you will probably incur some extra charges outside of that tier.

3. Understand pricing structure of EC2 servers. There are 3 pricing tiers. Servers are charged per hour of usage.

On Demand: Most expensive but pay as you go and guaranteed server time. Set up within seconds usually.

Reserved: Same as on demand but you pay for access to lower prices for 1 or 3 years with a one time fee.

Spot: (what i generally use) based on bid for unused servers. Cheapest prices of all. Set a maximum price you're wiling to pay for server time and a server is obtained through a bidding process. Usually costs 1/3 of price of on demand instances. If current bid prices rises above your maximum bid your server will be shut down and your data will be lost. I usually bid 5x more than the current bid rate just to be safe. Your bid price doesn't effect the market price you will pay. So if you bid $1.00 an hour and the market price was .30 you would still pay .30. If the price per hour spiked to .50 briefly you're server would still be running since your maximum bid is high enough.

Spot instances can take a few minutes to set up whereas on demand and reserved generally take just a few seconds.

Typical server prices per hour for linux. As of March 2011.
Players per server instance type is an estimate and not a tested value.

Micro - don't use. Too slow in my experience even for 2 people.

32 bit instances
Small -  up to 10 players
On demand: .085
Reserved: .03
Spot: .029-.031

Medium - up to 25 players
On demand: .17
Reserved: .06
Spot: .057-.063

64 bit instances
Large -  unsure 75-100 players?
On demand: .34
Reserved: .12
Spot: .114-.125

Extra Large - 200 players?
On demand: .68
Reserved: .24
Spot: .231-1.00

II. Creating and setting up server

1. Create security group.
A.  Navigate to security groups under ec2 in the aws console.
B. Create new group with name like minecraft so you know what it applies to.
C. Allow TCP Ports 22 and 25565 with source 0.0.0.0/0 on both.

2. Get elastic IP - Navigate to elastic IPs under ec2 and allocate new address.

3. Create a key pair - ec2 servers don't accept passwords to login via ssh. You will need to create a key pair for use when logging in. Name the key pair and download the file to somewhere you know where it is like your desktop.

4. Create instance.

A. Determine how many players you will want on your server. If more than 25 players will generally be playing you will probably want a 64 bit server. If its a small group of people go with 32 bit.
B. Go to the ec2 dashboard and click "create instance" I generally use the basic amazon 32 bit AMI for my server so that's what I would recommend. Again, use 64 bit if you're planning on running a larger server. By using 64 bit, though, you won't have access to the cheaper small and medium tiers should you chose to downsize your server at a later date. You want to chose an AMI with EBS since EBS is persistent, meaning if your server reboots for any reason your data will still be there.
C. Chose your instance type and payment method. I would suggest requesting a spot instance since it's MUCH cheaper. Just set a bid at 3-5x the current price and you should be pretty well protected if the current price fluctuates any.
D. Use default kernel and disk id
E. On the next step next to name just put in a name that will easily identify your server. This is just incase you have multiple servers running you can identify which is which.
F. Select your existing minecraft key pair you set up earlier as well as your minecraft security group.
G. Launch instance
H. After your instance is running go to elastic IP page and associate elastic IP with the instance

5. Log into instance

Windows
A. Download Putty
B. Enter your elastic IP
C. use keygen which is included in the putty install to change .pem into the putty format .ppk.
D. Associate the key with putty under shh and security options.
E. Connect

Mac
A. Open terminal
B. Navigate to the directory with the key pair file you downloaded earlier. To do this type in cd and then the directory. (ex. "cd desktop" for desktop)
C. Type "ls" to list files on your desktop or other folder
D. Type "chmod 400 yourkeyname.pem"
E. Go to AWS management and view your running instance. Right click on it and click connect. Under the prompt that comes up copy and paste the text displayed under "enter the following command line". It should look something like this "ssh -i macminecraft.pem root@ec2-50-17-202-58.compute-1.amazonaws.com". Change the root right before the @ symbol to ec2-user. Copy and paste this into the terminal.
F. You should be connected through ssh in your terminal at this point.

6. Setting up Minecraft on the server

I'm using the 32bit Amazon AMI. I'm not sure how this differs on different AMIs.
A. In terminal/putty type "wget http://www.minecraft...raft_server.jar"
B. To run server enter "java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui"
C. You should now be able to connect to your server using your elastic IP

7. Saving server/backing up server

Saving a server in its current state is really easy in ec2 and is one of the reasons i love ec2 so much. If you don't want to pay to run a server when you and your friends aren't on then don't. It gives you complete control.
Simply right click on a running instance and click "create image (EBS AMI)". When your server is saved into an AMI it can be started easily at the that point. Once you're AMI is created it's safe to terminate your instance. Your data is safe.
To launch a previously saved AMI navigate to AMIs and right click "launch instance" and your server will pick up where it left off.

Tips:
- you can not boot from a snapshot. Always save as an AMI.
- always release your elastic IP address after you shut down your server or you'll be charged .01 per hour for an unassociated IP. You could decide to keep the IP of course if you didn't want to distribute a new one everytime you started a server.

Reference : http://www.minecraftforum.net/topic/209252-amazon-ec2-server-setup-guide/

Comments

Popular posts from this blog

Oracle Import getting stuck Processing object type SCHEMA_EXPORT/

Oracle Import getting stuck Processing object type SCHEMA_EXPORT/ /database1/rdbm6/export> tail -200f impdp_D.SPORTS_03192012.log ;;; Import: Release 11.2.0.2.0 - Production on Mon Mar 19 15:34:10 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved. ;;; Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Master table "SYS"."SYS_IMPORT_FULL_02" successfully loaded/unloaded Starting "SYS"."SYS_IMPORT_FULL_02":  "/******** AS SYSDBA" REMAP_SCHEMA=SPORTS:SPORTS DIRECTORY=dpump_dir DUMPFILE=expdp_D.SPORTS_02282012.dmp LOGFILE = impdp_D.SPORTS_03192012.log REMAP_TABLESPACE = SPORTS_DATA_TS:SPORTS_DATA_TS , SPORTS_INDEX_TS:SPORTS_INDEX_TS Processing object type SCHEMA_EXPORT/USER ORA-31684: Object type USER:"SPORTS" already exists Processing object type SCHEMA_EXPORT/ROLE_GRANT Proc

ORA-06550, WMSYS.LT_EXPORT_PKG.schema_info_exp

When you do full database export it fails will following errors as below. Export: Release 11.2.0.1.0 - Production on Mon Sep 30 12:04:38 2013 Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved. ;;; Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SYS"."SYS_EXPORT_SCHEMA_01":  /******** AS SYSDBA schemas=user1 directory=data_pump_dir dumpfile=user1.dmp logfile=user1.log Estimate in progress using BLOCKS method... Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 0 KB Processing object type SCHEMA_EXPORT/USER Processing object type SCHEMA_EXPORT/SYSTEM_GRANT Processing object type SCHEMA_EXPORT/ROLE_GRANT Processing object type SCHEMA_EXPORT/DEFAULT_ROLE ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('user1&

How to make the email Address Dummy in Oracle Database?

How to make the email Address Dummy in Oracle Database? Query to make the email Address as dummy, update <tablename> set <Columnname> = '@' || <Columnname> where <Columnname>  is not null; Query to Remove the email Address as dummy, update <tablename> set <Columnname>= substr(<Columnname>,2,length(<Columnname>)) where <Columnname> is not null;