Amazon EC2 Micro Instance Roundup

Since some time now, Amazon offers a free (for 1 year) Micro Instance in their cloud for new sign ups. Micro instances are widely discussed as easy and relatively cheap way to run a cloud-based application (e.g. website/blog). Below a collection of a number of links regarding Amazon’s Micro instance hosting.

Some Fundamental Components

Amazon Elastic Compute Cloud (Amazon EC2): Who came up with this product name? It’s a VPN hosting service, allowing you to run UNIX/Windows virtual machines on the Amazon servers.

Amazon Elastic Block Store (EBS): Amazon offers 10 GB of EBS storage for free as part of the micro-instance. This storage is external to your instance, which is nice, since the data is available when you shutdown/restart the instance or switch to a completely new image.

Amazon Simple Storage Service (Amazon S3): 5 GB for free are offered for the Amazon S3. This is another way to store data external to your instance. However, in difference to the EBS, which can be mounted simple as a node in a unix file system, S3 requires one to use Amazon’s S3 access API.

Performance and Pricing

Amazon EC2 Micro Instance and Stolen CPU“: Cheap, but sometimes slow. In particular, if the CPU is heavily used for a few seconds, an automatic throttling might occur.

Amazon EC2 “micro instances” vs. Google App Engine“: EC micro not necessarily cheaper than GAE, especially when considering additional costs for EBS storage.

What is the real price of an Amazon EC2 machine?“: Some consensus that EC is rather expensive.

Amazon EC2 Micro instances deeper dive“: Calculates that a micro instance gets ca. ¼ of the allocation of a small instance. Suggests that rackspace and other competitors have better offerings.

WordPress at Amazon For $10 a Month“: Shows how to build up a website on the Amazon infrastructure costing only $10 a month.

Deploying node.js on Amazon EC2“: Estimates to run a node.js server would cost about $15 a month using a micro instance.


Amazon EC2 Cloud Installation.“: A nice tutorial walking through the various steps in setting up a micro instance.

Quick start to using Amazon EC2 as a free VPS!“: Gives a good introduction to various aspects of setting up a micro instance.

A LAMP guy’s n00b quick start to Amazon Web Services” Some discussion here on EBS storage vs. instance level storage.


Amazon Linux vs. Ubuntu for Amazon EC2“: Amazon Linux seems to be running okay. However, maybe it’s better to stick with a more ‘standard’ distribution.

Inside GWT RPC: Understand and Use the Serialization Format

GWT RPC is a technology with both great promises as well as many practical pitfalls. On the one hand, GWT RPC magically handles the transport of objects from a Java server to a JavaScript based client, without any need to create and maintain legacy data formats (e.g. in JSON). On the other hand, caused by the architecture of GWT RPC, it is easy to bloat up the size of JavaScript clients, since any for any object transported from server to client, the client needs a type-specific scaffold to instantiate the types in JavaScript. Calling eval(…), in contrast, is a much more lightweight solution. Moreover, serializing and deserializing large object graphs can be a performance hog, both for server and client.

Below a collection of a few interesting links, which can help in understanding GWT RPC better and using it beyond its initially devised use cases. In particular:

  • To have a detailed understanding of how the GWT serialization format works on the inside (“Understand the GWT Serialization Format”),
  • How to consume a GWT RPC service from a Java (JSE) client (“Consume GWT RPC using a Java Client”), and
  • How to generate messages in the GWT serialization format using an environment different from the GWT provided servlet (“Generate Textual Representations of Java Objects using GWTs Serialization Format”)

Understand the GWT Serialization Format

Stackoverflow “GWT RPC data format”

This discussion provides details on the GWT serialization format, particularly by referring to this presentation. Looking at the format in detail, it indeed seems to resemble a remote method invocation protocol (RMI) rather than a sole remote procedure call protocol. This is not necessarily good, since a lot of meta-data has to be sent with every request (e.g. class on which method is to be invoked).

Consume GWT RPC using a Java Client

Stackoverflow “Invoke a GWT RPC service from Java directly”

It appears that attempting to consume GWT RPC services from Java clients has mostly been pursued for testing purposes. However, it seems that some of the discussed libraries might be out-dated and might necessarily work with the most recent version of GWT (since the GWT serialization format can change from version to version).

Generate Textual Representations of Java Objects using GWTs Serialization Format

Simpler and Speedier GWT with Server Side RPC Serialization – TechHui

This article describes how data can be serialized using GWTs server side serialization and written into the initially downloaded HTML. This can speed up startup time of applications, since it leads to a reduction of RPC calls. I am not quite sure but there might have been mention of this technique in one of the Goolge IO talks on GWT performance. There can be other use cases for attempting to do the GWT serialization ‘by hand’, for instance if one wants to avoid using a Servlet container (tomcat, jetty) and replace it by something nicer like netty. The JavaDoc of the following classes are a good starting point to explore further how to perform GWT serialization Google Web Toolkit JavaDoc Class RPC, Restlet JavaDoc Class Object Representation






Xtend Tutorial

The world is rife for a new dominant programming language! Actually, has been rife for a couple of years, which, however, does not stop Java and C++ from dominating the screens of many unfortunate developers. Apart from the inarguably impressive features offered by ‘new’ languages, such as Scala, Goovy, Ruby, Haskell, Clojure, Dart? and Go, I am highly suspicious of these languages: What happens to the billions of lines of code written in legacy programming languages? Will my Groovy app work with the next update of Groovy, or will it work in 10 years, when I have to update my app? I don’t want something big, not the total reinvention of computing but would already be happy with more concise syntax to create inline objects, type inference and simple closures.

Xtend defines itself as a language for Java developers. In specific, it allows to write code, which is similar to Java but improved in many ways. Compiling code written in the Xtend language generates Java source files. These files can easily be used with any ‘legacy’ Java application or library. I have assembled a little tutorial and introduction to get started with the Xtend language. Find below:

  • How to install the Xtend Eclipse Plug-in
  • How to materialize Xtend Example Project in your Workspace
  • How to create Your Own Xtend Project
  • A discussion of Xtend Advantages and Disadvantages
  • Conclusions

Install the Xtend Eclipse Plug In

UPDATE: As Daniel pointed out below, Xtend is now available on the Eclipse Marketplace. Installing it from there rather following the instructions in this section, might be much easier!

  • Click Next again
  • Accept EPL licence agreement
  • Restart eclipse

Materialize Xtend Example Project in your Workspace

After the installation of Xtend is complete, the best way to get started is to install the Xtend example

  • Create a new Example Project as shown below

  • Or under the new project wizard select “Examples / Xtend Examples / Xtend Tutorial”

  • Initially the project was not built correctly in my eclipse.

  • However, after closing and reopening the project everything appeared to be (maybe the Infinitest plugin in my installation has caused the problem, so I have deactivated it).
  • Below a screenshot of the examples provided by Xtend:

  • You can right click the project and select “Run as JUnit test” to execute some of the examples

Create Your Own Xtend Project

After browsing and testing the provided examples, it’s time to create a new project with Xtend support.

Xtend seems to be nicely integrated with the eclipse PDE. Therefore, its easiest to create an Xtend project as eclipse Plug In Project. Using the PDE tooling such projects can be easily deployed as executable applications on numerous platforms. However, since Xtend generates plain Java files, we can always compile the generated files as independent Java application. Below the steps to create a simple Hello World application.

  • Use Eclipse’s New Project Wizard to create a new ‘Plug-in Project’
  • Adjust the source folder and output folder to sensible values (Maven anyone?) and create the project

  • Open the MANIFEST.MF file in the folder META-INF
  • Add the package org.eclipse.xtext.xtend2.lib to the [Imported Packages] on the [Dependencies] tab

  • Also add the following packages:



  • Create a new source folder for your project: src/main/xtext (Right click the project and select Build Path / New Source Folder)
  • Now create a new package in the source folder src/main/xtext
  • For instance, de.mxro.examples.xtend1
  • Right click this package and select New / Xtend Class

  • Select the name “HelloWorld”
  • When prompted to add the Xtext nature to the project, click [Yes]

  • Right click your project and select “Properties”
  • Open the properties for Xtend / Compiler
  • Change the output folder to src/main/java and deselect “Override existing files”
  • Click [Apply] to apply the changes

  • Go back to your file HelloWorld.xtext and define the following class:

class HelloWorld {

    def public void helloWorld() {

        val message = “Hello, World!”;




Tip: writing the symbol “«” can be achieved by pressing CTRL + SHIFT + < (or ,)

  • Now check the folder src/main/java. Here, a file should have been generated as follows

import org.eclipse.xtext.xtend2.lib.StringConcatenation;


public class HelloWorld {
public void helloWorld() {
final String message = “Hello, World!”;

   StringConcatenation _builder = new StringConcatenation();

   _builder.append(message, “”);




Does not look 100% efficient but that’s the tradeoff for source code generation. I did not find out how to define static methods using Xtend, so we need a standard Java class to run this code:

  • In the source folder src/main/java add a Java class “Application”, while checking create main(String[] args).
  • Implement the following class

class Application {


     * @param args


    public static void main(String[] args) {

        new HelloWorld().helloWorld();



  • Right click the file and select “Run as Java Application”

Volia! You should be friendly greeted with the output “Hello, World!”

Xtend Advantages and Disadvantages

After following this little exercise and browsing the Xtend documentation, these are a number of advantages and disadvantages I see in this languages:


  • Allows writing more concise code for the Java platform.

It is no secret that Java syntax is unnecessarily verbose. This sets the bar relatively low for better languages for the Java platform. Xtend has a number of very nice features to allow writing more concise Java code, my favourite example being type inference.

  • Is fully compatible with most Java technologies.

Although the JVM has received considerable attention with alternative Java byte code generating languages such as Scala, not everything Java is Java byte code. Most notably, the Android platform draws on the Java language but is not compatible with generated Java byte code. The Google Web Tookit (GWT) is another technology working with the Java language but not with the JVM. Xtend enables to write code, which interoperates both the platforms build on top of the JVM (since its Java source files can be compiled into byte code) as well as platforms build on top of the Java language syntax.

  • Performance

Since the Xtend language is close to the Java language and generates relatively optimal Java source files, its performance can be expected to be far superior to other improved Java dialects, especially Groovy. Moreover, since it does not generate byte code but Java source files, more compiler optimization can be applied to the applications.


  • Tight coupling with eclipse tooling

Xtend and Xtext are doubtlessly eclipse technologies through and through. This is a definite advantage for starting to use these technologies since they offer nice integration with the eclipse IDE. As a downside, however, code written in the Xtend language might be difficult to use with other tools apart from eclipse. On the other hand, the Java code generated by Xtend is vanilla Java code (apart from the lightweight Xtend library used in the generated code). This code, of course, can be used by most other tools. Therefore, I have chosen above to place the xtend source files not in the main Java source code folder of the project (src/main/java) but into a separate folder (src/main/xtext). This enabled to let Java code be generated into the src/main/java folder. From there, it can be picked up and used by other tools such as Maven.

  • In places, insufficient documentation

The documentation available for Xtend is far from extensive. In comparison, the documentation available for Groovy is extensive including books and various web sites.


I believe that Java and C++ are the very best programming languages around. Not in terms of developer productivity, measured in implemented features/hours of course, but in terms of creating sustainable code. Most Java or C++ applications written a decade ago will still run today. Java programs even without the need to be recompiled. This makes one rather confident that a decade from now, still people will be able to compile and run written in Java and C++ today. Adopting terms from the finance industry, they are simply too big to fail.

Give that, I am very suspicious of any new programming language. That is it more elegant and allows me to be more productive are simply insufficient arguments. Code is too difficult to write that I would want to run into the risk of having to dump it ever. Xtend offers a neat compromise. It allows to write code in a more modern, more productive language but yet defining the application in plain old Java code. Therefore, I see Xtend primarily as a useful tool to generate Java tool. Even if Xtend becomes deprecated at some point in time, one always has the Java code to fall back to.

Mistakes to Avoid

As mentioned above, installing the plugin following the documentation provided on the Xtend tutorial page has not been a smooth process. Below a number of mistakes in installing the plugin, which are better avoided.

Do not install only the Xtend2 SDK

Installing only the Xtend 2 SDK package as shown below …

.. and creating a new class …

… will result in a problem being reported by Xtend.

Do not Install the Xpend/Xtend All-in-One Package

Selecting “Xpand/Xtend All-in-One” …

… with all these packages …

… will not allow you to create the Xtend example project.

Do Not Create an Xtext Project to Start an Xtend Project

Xconfused? An Xtext project does not automatically allows to get started with Xtext. It is better to create an eclipse Plug-in project as shown above.


Xtend Official Overview

Xtend 2 – the Successor to Xpand post by creator Sven Efftinge