Posts Tagged 'Amazon ElasticBeanstalk'

Amazon ElasticBeanstalk Health Check URL

I have been working on developing and deploying an application to Amazon ElasticBeanstalk over the last few weeks. I love the environment and the fact that it has the benefits of a true Platform as a Service (PaaS) but also the power of Infrastructure of a Service (IaaS) should I require. One of the things that Beanstalk does is to check application health periodically and can email the administrator an alert if things are not healthy.

So how does Beanstalk monitor applications ? Firstly, based on a configurable period ( default 30 seconds) but up to 5 minutes, a request to a health check URL is sent. This is a HTTP HEAD request and a response of 200 OK is expected. Application status is considered to be in one of four states based on the response to the request:

  • Green – application has responded to health check URL in last minute
  • Yellow – No response to health check URL in last five minutes
  • Red – No response for more than 5 minutes
  • Grey – Status unknown

If an application is found to be in an unhealthy state then an alert email is sent. The health check URL is used at two levels. One at the load balancer level for the whole application and secondly on individual server instances behind the load balancer. Should an individual instance fail to respond for 10 consecutive health check requests then the instance is automatically terminated and a new one started as part of the auto scaling.

The default URL for the health check is /. This can be overridden and it is often appropriate to provide a custom URL for the health check so that the load on the server is minimal. Requesting the home page just for the HEAD section is not a sensible thing in most cases. My application is using Spring MVC so I have added a simple Controller with a health check URL that is shown below:

@Controller 
public class HealthCheckController { 
    @RequestMapping(value="/healthcheck", method=RequestMethod.HEAD)
    public void healthCheck(HttpServletResponse response) {
        response.setContentLength(0);
        response.setStatus(HttpServletResponse.SC_OK);
    }
}

Working with Elastic Beanstalk and Amazon AWS in general is exciting but requires a thorough understanding of all the components and how they can be integrated to form a coherent whole. Learning Tree have developed a four day course that explains how to effectively use Amazon AWS to its maximum potential. If you are interested in AWS, why not consider attending. The course has been developed by Cloud and Security expert Steve Lockwood and details can be found here.

Chris Czarnecki

Selecting a Cloud Java Platform

I recently posted about a project I am working on that will use cloud computing, and in particular a Java-based Platform as a Service (PaaS). The choice of platform came down to three providers:

  • Google App Engine
  • Amazon ElasticBeanstalk
  • CloudFoundry

Based on our requirements, each of the above platforms can be summarised as follows:
Google App Engine
This platform has many nice features, but does not support full Java. The lack of relational database support is also not ideal, but support for JPA is provided. Spring Framework applications can be deployed seamlessly. For our applications, where we wish to connect to Web services, the restricted I/O library support, coupled with the fact the outbound connections are forced to close after 10 seconds is not acceptable. The cost model is clear and attractive with a high free CPU and storage quota. Another factor for our application is the fact that SSL on customer domains is not supported.
Elastic Beanstalk
Amazon’s offering is attractive in that it offers the elegance of PaaS, but also the control of IaaS if required with support for full Java. Whilst still in beta, this service offers everything we require. The usage cost is clearly defined. A downside maybe is that the service is still in beta.
CloudFoundry
This service from VMWare, is very similar to Elastic Beanstalk without the lower level (IaaS type) control. The toolset is elegant and simple. The feature set is not quiet as rich as Beanstalk, for instance there is no email service as is available from Amazon AWS. However, the downside for this service is that it is in beta and currently free to use, but there is no indication as yet as to what the pricing model maybe.
In summary
We have decided to use Amazon Elastic Beanstalk, as it offers all the features we require with a clearly defined cost model. In addition, it offers the control at the level of IaaS if required. CloudFoundry is elegant too but with no pricing model available, and we cannot launch a live system on this. Google App Engine is elegant but suffers because of the lack of full Java support required for out application. We have in the background also began examining CloudBees. I will let you know about that in a future post. I will also keep you updated with out progress using Elastic Beanstalk. What is nice for Java developers is that there are many excellent choices available for PaaS.

Chris Czarnecki


Learning Tree Logo

Cloud Computing Training

Learning Tree offers over 210 IT training and Management courses, including Cloud Computing training.

Enter your e-mail address to follow this blog and receive notifications of new posts by e-mail.

Join 53 other followers

Follow Learning Tree on Twitter

Archives

Do you need a customized Cloud training solution delivered at your facility?

Last year Learning Tree held nearly 2,500 on-site training events worldwide. To find out more about hosting one at your location, click here for a free consultation.
Live, online training
.NET Blog

%d bloggers like this: