Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Monday, June 23, 2014

AWS EC2 user data

You can perform any bootstrapping action you would like using user data.  Here is an example of installing Apache, PHP, and MySQL.  Then Apache, PHP and MySQL are started.  Then a sample application is installed on Apache.

#!/bin/sh
yum -y install httpd php mysql php-mysql
chkconfig httpd on
/etc/init.d/httpd start
cd /tmp
wget http://us-east-1-aws-training.s3.amazonaws.com/self-paced-lab-4/examplefiles-as.zip
unzip examplefiles-as.zip
mv examplefiles-as/* /var/www/html

Tuesday, December 3, 2013

Boot strapping - automatically install and start Apache on EC2 launch

Here is a very common user data boot strapping script for installing Apache, PHP, and starting the Apache server:
#!/bin/sh
yum -y install httpd php
chkconfig httpd on
/etc/init.d/httpd start

Boot strap PHP and ELB examples

Here is strap script that can be used to install and start Apache along with PHP.  It will then download and unzip the AWS ELB examples.

yum -y install httpd php
chkconfig httpd on
/etc/init.d/httpd start
cd /var/www/html
wget http://bootstrapping-assets.s3.amazonaws.com/examplefiles-elb.zip

unzip examplefiles-elb.zip

Friday, November 8, 2013

ELB : Some common questions

Q: Is a straight through reverse proxy possible with ELB? For example, a Wordpress instance that lives at my domain.com/blog.  Is it possible with ELB similar to apaches mod_proxy passthru functionality?
A: ELB does not support this feature.  Suggestions: Create a sub-domain like blogs.crafsy.com and have a separate DNS record + ELB for it.

Q: Is there a way to force traffic to a particular backend app server when fronted with ELB? 
A: ELB supports sticky sessions for ensuring that traffic within the same session flows to the same box.  For software release purposes, you could have a subdomain like test.craftsy.com and a separate DNS record + ELB.

Q: Can you have a zone apex in Route53 point at multiple ELB's? I assume this is so. (e.g. craftsy.com -> ELB1 (production a), ELB2 (production b)
A: Yes, if you use non-simple routing policy (weighted, latency or failover). 


Monday, September 9, 2013

Hadoop Cluster and Amazon EMR

Accenture calculated the total cost of ownership of a bare-metal Hadoop cluster and derived the capacity of nine different cloud-based Hadoop clusters at the matched TCO. The performance of each option was then compared by running three real-world Hadoop applications.  The full report is here:

http://www.accenture.com/us-en/Pages/insight-hadoop-deployment-comparison.aspx

There report compares the performance of both a bare-metal Hadoop cluster and Amazon ElasticMapReduce (Amazon EMR).

Monday, April 22, 2013

Oracle WebLogic with AWS Auto Scaling

The question of using Oracle WebLogic with AWS Auto Scaling and propagation of session state is often asked.  Before getting into the details, let's look at the two ways of handling session state at the server layer (using cookies in the browser can be used as well):
1. Session stickiness : session data issue is to send all requests in a user session consistently to the same backend server. 
2. Session in database : Another solution is to keep the per-session data in a database.  Of course, AWS ElastiCache, SimpleDB or DynamoDB, or RDS.

If the session is stored in a database, nothing needs to be done when using Auto Scaling with WebLogic; for obvious reasons.


When sticky sessions is used, nothing needs to be done, but the reason is not so obvious so let's discuss it.

When a request comes into a WebLogic cluster via a load balancer (AWS ELB for example) or through Apache (mod_proxy_balancer plug in) the first time,  WebLogic creates an HTTP session on the primary node and also puts session state on a backup node. (You can provide guidance/control where to put the failure/backup).  If the server goes down that contains the primary WebLogic node, the new primary node will know where the backup session is stored and the session state will automatically get replicated to the new node.  So when AWS Auto Scaling is used there is nothing that needs to be done from an AWS perspective. 

Tuesday, April 16, 2013

EC2 Apache HTML file locations

My last blog discussed using user data and to install the Apache serve on your EC2 instance.  The next thing to do is place your web pages in the web server directory. The directory location is:  /var/www/html/.  You need to make sure you are the root user to add or modify files in this directory.  You can do this by using sudo su.

User data to install Apache and PHP


One of the most basic components on an EC2 instance is Apache and PHP.  Installing Apache and PHP is made easy with a short shell script, yum, and user data.  Here is all that needs to be placed in the user data section of the EC2 instance:

#!/bin/sh
yum -y install httpd php
chkconfig httpd on
/etc/init.d/httpd start