It's been one month (23 days) since I move to Amazons EC2, aka Amazon Cloud, aka AWS. Overall I am very pleased with the performance of my instance, which I use as a webserver. Also the extra volumes perform great. It's been up for 100% in Januari 2009.
Here are some numbers so you can get an estimate of what Amazon EC2 cost:
| $0.11 per Small Instance (m1.small) instance-hour (or partial hour) | 537 Hrs | $59.07 |
| $0.100 per GB Internet Data Transfer - all data transfer into Amazon EC2 | 22.554 GB | $2.26 |
| $0.170 per GB Internet Data Transfer - first 10 TB / month data transfer out of Amazon EC2 | 32.379 GB | $5.50 |
| $0.010 per GB Regional Data Transfer - in/out between Availability Zones or when using public IP or Elastic IP addresses | 0.023 GB | $0.01 |
| $0.12 per GB-month of provisioned storage | 23.073 Count | $2.77 |
| $0.11 per 1 million I/O requests | 4,398,873 Count | $0.48 |
| Total | $70.09 |
Overall I'd recommend Amazon EC2, but it's a little more expensive than an average Private Hosting plan, but this setup is more scalable.
As a freelancer in Dutch IT, you will almost always use a contracting company. This company makes an initial contact with the end-customer and receives and pays your invoices.
When you are in contact with a new contracting company, you can check IT Bemiddelaars to see what a company has done before, compare rates and cost.
When you would like to review an "IT bemiddelaar", please go to IT Bemiddelaars to enter the information you'd like to share.
Besides the extensive OpenVPN documentation I couldn't really find a step by step guide on how to setup an OpenVPN server and client.
I want to be able to connect my Fedora Core 10 laptop to the home-network via a Fedora Core 10 server.
The server is 192.168.0.1, running Fedora Core 10 with openvpn 2.1. Newer versions are likely to work as well.
The laptop has a dynamic IP address.
Please read the OpenVPN documentation if you run into troubles.
First setup the Certificate Authority keys.
cd /usr/share/openvpn/easy-rsa/2.0/
vi vars
# Fill KEY_COUNTRY, KEY_PROVINCE, KEY_CITY, KEY_ORG, and KEY_EMAIL, all at the bottom.
. ./vars
./clean-all
./build-ca
# Press "enter" on each item.Now setup the Server key and the Diffie Hellman key.
./build-key-server server
# Press enter on each item.
./build-dhAnd build the client keys, each client needs its own key, with a unique Common Name. The IP address assigned to the client is related to the Common Name, so if you use non-unique Common Names, you will have conflicting IP addresses.
./build-key client1
./build-key client2
./build-key client3
mv keys /etc/openvpncp /usr/share/doc/openvpn-2.1/sample-config-files/roadwarrior-server.conf /etc/openvpn/server.conf
vi /etc/openvpn/server.conf
# Check the ca, cert, key and dh variables.Start the server by issuing:
chkconfig openvpn on
service openvpn startMove the ca.cert, client1.crt and client1.key to the client, in /etc/openvpn/keys and copy the configuration. You will need to modify the client.conf a little bit.
/usr/share/doc/openvpn-2.1/sample-config-files/roadwarrior-client.conf /etc/openvpn/client.conf
vi /etc/openvpn/client.conf
# Find "remote" and set it to the internet address of your VPN server.Start the client:
chkconfig openvpn on
service openvpn startOn both server and client issue ifconfig tun0 to see what IP-address is assigned to the entry of the tunnel. From the either end of the tunnel you should be able to ping the other end. Also tcpdump -n -i tun0 should work.
Hope this works for you as well, check out /var/log/messages for information. /etc/init.d/openvpn status dump a status of all connected clients to /var/log/messages.
It's very difficult to get grip on the estimates price of a "simple" LAMP server. Here are some numbers to help you get an accurate estimate of a LAMP server.
So as a conclusion: One average webserver costs around $ 120,- (with tax) per month to run on the EC2. There are cheaper solutions to host your website(s), but Amazon EC2 provides the option to add a machine in a couple of minutes or even automated. This flexibility is not found in many other products.
While experimenting with Amazons interpretation of cloud computing, here is what I did to create persistent storage, create an instance and attach the storage to the instance.
Go to Amazons developer section and download, unpack and install the files. Now edit ~/.bashrc (or any other file that is executed at login) and add this:
export EC2_HOME=~/.ec2
export PATH=$PATH:$EC2_HOME/bin
export EC2_PRIVATE_KEY=$(ls $EC2_HOME/pk-*.pem)
export EC2_CERT=$(ls $EC2_HOME/cert-*.pem)
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/
export EC2_URL=https://eu-west-1.ec2.amazonaws.comec2-describe-regions.
Check out the wonderful section on Paul Stamatiou's website at "Getting Started". It describes how to create and use the keys.
You will have to authorize access from the internet to port 22 and 80, or any other. Here is how it's done:
ec2-authorize default -p 22
ec2-authorize default -p 80default refers to all machines unless specified differently.An instance can be seen as an individual machine. It's virtual, but who cares about that? I use the image "ami-2a0f275e", but see other images can be used as well. Use ec2-describe-images -o amazon to get a list of available images owned (-o) by amazon.
ec2-run-instances -z eu-west-1a -k ec2-keypair ami-2a0f275eec2-describe-availability-zones.To allocate some space on the S3 infrastructure of Amazon, use this command:
ec2-create-volume -s 1 -z eu-west-1aWhen the volume is created; assign it to an instance with this command:
ec2-attach-volume vol-38a24751 -i i-c2f2c5b6 -d sdbec2-describe-volumes to get a list of available volumes.ec2-describe-instances to get a list of available instances.dmesg to see if attaching has worked. This is the ouput I got:dmesg | tail -n 1
sdb: unknown partition tableLogin to your machine using SSH:
ssh -i .ec2-keypair root@MACHINEdescribe-instances.Host *.compute.amazonaws.com
IdentityFile ~/.ec2/ec2-keypair
User rootNow that you are ready, login and type:
mkfs.ext3 /dev/sdbMount the volume (once) by issuing:
mount /dev/sdb /mntYou can continue to use the instance with this "static" IP, but to associate one IP with this instance, follow these steps. First register an IP:
ec2-allocate-addressNow link the IP with an instance.
ec2-associate-address 79.125.5.49 -i i-0ca09678The Amazon elastic compute cloud and S3 facilities work great, I'm not sure about the availability of EC2, not about S3, but Amazon states that S3 should be more "secure" then storing stuff in the local storage of the instance.
So you like bash, just like me. There are times though where you'd need to work on a machine where there is no bash, but ksh(3). Here is a list of commands and keys to help you:
Hit escape a few times, now hit "k" and "j" to move back and forward into the history.
Edit the command with the letters "h" and "l".
Type a part of your command, hit escape a few times, now hit "\" to complete the command.
You can't display what your options are, (in bash just tab a few times)
Either run this command once, or add it to your ~/.profile:
export PS1="${USER}@$(hostname) ${PWD##*/} $ "Have you ever heard of (or used) a group password in Linux? For me this strange concept was new, but here's what you can use it for.
A group password in Linux allows a user to temporarily (in a subshell) gain extra permissions of a group, after successfully entering the group password.
To set a group password use gpasswd:
# gpasswd finance
New Password:
Re-enter new password:To gain those extra permissions you can use newgrp:
$ newgrp financeSome of the disadvantages are:
The User Mask (umask) can be managed with the command umask. A umask is the reverse value of the octal permission set that files and directories are created with.
So, a umask of 0777 creates files with an octal permission value of 0000; no permissions to read, write or execute.
But; there is a strange thing about the umask; it never allows to make files executable. Here is a demonstration of this "flaw"/"security feature".
$ umask 0027
$ touch me
$ ls -l me | awk '{print $1}'
-rw-r-----I would have expected 750, instead 640 is produced. This is default security behaviour of UNIX/Linux.
Network Address Translation is a technique to masquerade IP addresses on your internal LAN to the outside world. In other words; the outside world will not be able to look into your network.
This technique is easy to setup and maintain, saves IP addresses and is likely more secure that pure routing. To set it up, you require:
To be able to use IP forwarding, you must tell the kernel that it's okay to forward traffic from one network card to another. This setting is found in /etc/sysctl.conf. Set net.ipv4.ip_forward to 1.
To do this, execute:
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.confMake sure the service IPtables is running now and is started at bootup:
# service iptables status
<output omitted>
# chkconfig --list iptables
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:offNow that the kernel knows it's allowed to forward traffic from one NIC to another, configure the firewall. The firewall is the intelligent part of setting up NAT, IPtables actually 'does the work'. Here are the commands to set it up:
/sbin/iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEYou have only configured the firewall for now, a reboot would undo all settings. Run this command once you are happy with the setup:
# /sbin/service iptables saveReboot to test the setup. Your LAN client will have to set the default route to the IP address of the NAT machine's LAN NIC.
There are a few ways to start (and stop) daemons at specific runlevels. For Fedora you could use modify how Apache (httpd) is started:
This is a simple command line tool to tell the the startup facility to enable (on) the Apache (httpd) daemon at runlevel 4 (--level 4). Works great and fast, but the script httpd must have some parameters in the file to let chkconfig know what to do with it:
# chkconfig: 4 85 15
# description: Apache is a World Wide Web server. It is used to serve HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pidls /etc/rc4.d. The numbers of the startup script represent the order of how they are started.
A much simpler, more simplistic method to start Apache. This command symbolically links /etc/rc4.d/S85httpd to the startup script of Apache. Don't forget to also stop the daemons with this set of links:
ln -s /etc/init.d/httpd /etc/rc0.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc1.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc2.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc3.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc5.d/K15httpd
ln -s /etc/init.d/httpd /etc/rc6.d/K15httpdA text-based graphical menu to enable or disable services.
A graphical interface to enable or disable services.
| About | Consultancy | Articles | Contact |
|
|
|
|
|
| References | Red Hat Certified Architect | By Robert de Bock | Robert de Bock |
| Curriculum Vitae | By Fred Clausen | +31 6 14 39 58 72 | |
| By Nelson Manning | robert@meinit.nl |