Adding the java code to start and EC2 machine, define rules, define location, create security key, security group and to terminate it programmatically.