Intellij Idea CE recommends Sun Java on Ubuntu 12.04. Amazon EC2 API Tools comes packed with OpenJDK and if you try to uninstall OpenJDK amazon ec2 api tools uninstalls with it to.
How to install both Java and start IntelliJ with Sun and Amazon tools with Open?