EC2 aiCache howto

Launching your aiCache instance

Registering for aiCache AMI

  1. Before being able to use aiCache on Amazon AWS you should subscribe by going to Amazon AWS subscriptions.
  2. Login to amazon AWS using your amazon credentials, fill in the necessary information, and follow the on screen wizard.
  3. Once the subscription process is completed a message will appear showing your confirmation/verification code. You will then be able to start a new aiCache instance

Launching the aiCache instance

  1. To launch a new aiCache application instance you need to go to your amazon AWS Management Console click on the button (Sign in to the AWS console)
  2. Login using your AWS credentials, use the same credentials you have used to subscribe for aiCache.
  3. Once you are logged in you will see a screen that looks like the figure below 
  4. Click om AMIs

Selecting aiCache AMI
  1. Select Public Images, All Platforms In the Viewing box  and type aicache 
  2. You will see screen like below. 
  3. Select the AMI and click on Launch button
On next screen you will be asked for instance details (Number of instances, Instance Type, Availability Zone)
As aicache is 64 bit only system the smallest instance type will be m1.large. 

Next step will ask for choosing Kernel ID, RAMDisk ID 
You can leave it default unless you have special reasons to change them
On select Key Pair section choose one of you existing key pair or create & download new one 


Warning: Key pair is considered confidential , if anyone can access your key pair he is likely
to be able to control, terminate, restart or tamper with your Aicache and any Amazon EC2
instance you launch using this key pair.

On the next screen you will have to choose Security Group for aiCache instance. 


Minimal rule-set for this instance shall look like this 



Now your instance is ready to lunch. 
If no problem accrue you will see screen like this.
Click on Lunch button and your instance will be created. 

Testing aicache instance

Point your browser to the amazon EC2 address - http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com
If aicache started correctly and no problems with config file, http://www.google.com should appear

Connecting to your aicache instance

Now you can connect to your aiCache instance and adjust config files as necessary via SSH.  
For windows ssh you can use Putty. For Linux and Mac use your favourite ssh clients.
You will need to select your access key when you connect to server via SSH. 
Linux ssh command looks like this 

ssh -i path_to_aws_keypair root@ec2-xx-xx-xx-xx.compute-1.amazonaws.com

Where ec2-xx-xx is the public DNS name for your instance

Location of aiCache. 

aiCache default location is /usr/local/aicache
Default configuration file is  /usr/local/aicache/aicache.cfg 
Log files are located at /var/log/aicache folder 

Restarting aiCache

After you did some changes in config file, you have to restart or reload aiCache process.
aiCache starts via /etc/inittab, so in order to restart aiCache just run " pkill aicache " command 
The corresponding line in /etc/inittab is 

YA:234:respawn:/usr/local/aicache/aicache -c aws -f /usr/local/aicache/aicache.cfg

aiCache can startup manually or via custom startup script, but it is recommended not to change its current behavior if you are very sure about that.

The syntax of /etc/inittab is 
RUN_ORDER(in alphabetic order):LINUX_RUNLEVEL:START_TYPE:COMMAND

Our example is: 
YA: Last process that inittab starts after system boot 
234: aiCache will start at runlevels 2, 3, 4. You can find more info about Linux runlevels here  http://en.wikipedia.org/wiki/Runlevel
respawn: Means that that Linux init will act as watchdog and start aiCache process it is stopped or crashed 
/usr/local/aicache/aicache -c aws -f /usr/local/aicache/aicache.cfg: BINARY -c LICENCE -f CONFIG_FILE. 

If for some reason you need to stop aiCache process and watchdog you have to 

1. Edit /etc/inittab and comment "aiCache line" by putting # symbol at the beginning 
2. Reload init by "telinit q" command 

To start aiCache again remove comment and reload init. 

Upgrading aiCache

aiCache  contains from single binary and config file. So upgrade procedure is quiet simple. 
Command below will do it 

/usr/local/aicache/update.sh  && pkill aicache