How to deploy a Java EE application in the Amazon cloud? - java

Here's the thing: I need to take a certain Java EE web app and deploy it to Amazon EC2 (which I will need to setup first) starting next month (using the http://aws.amazon.com/free/faqs/ AWS Free Tier Usage - hope it supports Tomcat + MySQL/PostgreSQL).
The problem: I have never ever deployed a Java EE app (not even a normal one on a dedicated hosting) nor have I setup an Amazon EC2 enviorment.
Are there any, idiot proof preferably, tutorials/how-to's/whatever on doing it from the very beginning (signing up to Amazon) till the very end (when your app is all up and running)?
I did find some tutorials on how to setup an Amazon EC2 instance, how to normally deploy a Java EE app but what I'm looking for is a single tutorial putting it all together.

Start with an Ubuntu AMI. Then install tomcat. Now put the WAR file of your J2EE app where tomcat can see it. You can use the AWS console to start/stop your machines, configure firewall rules that allow you to access port 80, etc. There won't be a step by step guide telling you exactly what to do, welcome to being a programmer.

Once we have the instance (like Ubuntu) running http://youtu.be/hJRSti6DsJg then, installs Glassfish (Java EE server) and configure it to work with Java EE. It depends more of the instance itself (Ubuntu) than EC2 Amazon... here a nice video (how to install Glashfish in Ubuntu + Netbeans config) http://youtu.be/CKuoDm6bqRM
Note:
Keep in mind both videos are a little old (may some adjustments are necessary)
The videos are indirectly related. But my point is: there isn't much info about Amazon AWS and Java EE, but there are a lot info about Amazon AWS and Linux, and Linux and Java EE.
Update
You can try Amazon Beanstalk (Deployment & Management) integrated with Netbeans (without Glashfish?) http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.html
SSH to Elastic Beanstalk instance
http://aws.amazon.com/java/ (Amazon + Java)

Boxfuse now supports deploying Java EE applications using either Tomcat, TomEE Web Profile or TomEE Plus to AWS with a single command
boxfuse run mytomeeapp-1.0.war -env=prod
This will create an image, provision all necessary AWS infrastructure (AMIs, security groups, auto-scaling groups, launch configurations, ELBs, Elastic IPs, ...) and launch the instances. It supports blue/green zero downtime updates with Elastic IPs and ELBs.
You can find a tutorial here: https://boxfuse.com/blog/javaee-aws
Disclaimer: I am the founder and CEO of Boxfuse

Related

How to upload Servlet/JSP website through Amazon Web Services?

I am working on a Servlet/JSP project and I want to host it on aws.amazon.com. I have already signed up for Amazon Web Services and after signing in this page opens up and I have no idea what to do or which option to select.
I think AWS provides a lot of customization with a lot advanced technical options to choose from, but this is difficult for beginners who just want to make their site running.
My project will use these:-
JSP/Servlets
CSS
MySQL
Struts2
Tomcat WebServer
I would suggest these approaches to study:
Elastic BeanStalk - This is AWS simply hosting model. If you're not IT savy you should pursue this approach
EC2 with MySQL RDS - In this case you'll create a Virtual Machine(s) (EC2) install Tomcat and other dependencies and deploy your app. You'll then use RDS to store your data (which is MySql as a service)
EC2 only - YOu'll do the same as 2. but install your own instance of MySql. There may be AMI's offered that you can provision that will meet your application requirements.
Other reading:
Route53 if your going to use AWS for your domain records
Elastic Load Balancing if your going to need High Availability
Elastic Block Store if you want persistent disks accross VMs
Network Security Groups to secure your VMs (for 1. and 2.)
Virtual Private Cloud for additional security
CloudFormation if you want to automate provisioning
There are many articles on: AWS Architecture
There is a eclipse plugin for Amazon web services.
The AWS Toolkit provides an AWS Java web project template for use in Eclipse. The template creates a web tools platform (WTP) dynamic web project that includes the AWS SDK for Java in the project's classpath. Your AWS account credentials and a simple index.jsp file are provided to help you get started. The following instructions assume you have installed both the Eclipse IDE for Java EE Developers and the AWS Toolkit plug-in. For more information, see Setting Up the AWS Toolkit for Eclipse.
Also check this & this
I would recommend 1st approach using Beanstalk to deploy your jsp application. There you are going to leverage all the advantages of AWS like load balancing, auto scaling, ddb and DW support and many other technologies. With Beanstalk you setup dev environment on your local machine and deploy the changes in AWS and once setup is done you are done...
May be you will need to spend some time on migrating from MySQL but that will be work on longer duration when you are going to have lot of users.

How do I deploy own server (written in Java) on AWS (something like Openshift's DIY)?

Is there some thing similar to "Openshift's DIY" on AWS?
I never use AWS, now need deploy our team's own server(written java) on cloud, and we must use AWS.
This server listening to a custom port, and offering RPC service for client.
I wonder whether it is possible to do DIY on AWS, and how?
And whether that supports go language server?
OpenShift is a PaaS provider. It gives you a Platform with a Java runtime and an application server (Tomcat, Wildfly,...) on which you can deploy your application.
AWS has a lot of different services. EC2 is a IaaS. It gives you an Infrastructure. It starts a virtual machine with the operating system you've choosen, then you install Java and you can deploy your application. Some additional setup has to be done on the virtual network.
AWS Linux server instances can run Go applications just like any other Linux server. You won't get anything like Google App Engine of course. You'll just get a bare Linux server.

deploy java web project without deploying JDK and tomcat on windows azure

Can we deploy a java project on windows azure without uploading JDK and Tomcat on storage in windows azure? If yes, please provide me steps how to do it.
I made a project as provided in windows azure create a sample application in Java.
But at time i have to create a cloud service, I am supposed to deploy JDK and tomcat which totals around 100-130 MB. Isn't there any solution so that we should deploy cloud service and not JDK and tomcat.
Azure VM images do not include the JDK or any of the Java web servers (Tomcat, Jetty, etc.). You need to get them, from somewhere.
So... when building a Java app via Eclipse and related Cloud Service template, there's a startup script that bootstraps your worker role instances. This involves grabbing the SDK and web server (Tomcat, Jetty, etc.) from somewhere and placing it on your instance's disk. Since you're using Cloud Services (worker role in this case), the OS disks are stateless: Each time a new VM instance spins up, it starts fresh, and you're responsible for setting things up (via startup script).
So: You need to set up your SDK and web server. You can either bundle these with your deployment package or download them from somewhere. The former increases the deployment package size by quite a bit (maybe 100MB?). The latter requires you to download the bits from somewhere. You can either download from somewhere like Oracle (which requires you to go through a license agreement each time), or from your own storage account (which is very fast, as long as it's in the same region as your code deployment). Further: being in the same data center, there are no bandwidth charges when downloading stuff to your worker role instances.
The current Eclipse plugin has a setting for your worker role, where you specify blob storage for your JDK and web server. By doing this, it's basically a one-time setup (except when it's time to upgrade the JDK or Tomcat/Jetty version, and then you'll need to re-upload to blob storage). Once these bits are in blob storage, you only need to include your Java classes in your deployment package.

Run Java EE app on EC2

Can anyone point me to the steps/resources that describe:
How to deploy a Java EE app on amazon-EC2
Maintain changes to the meta-data of the app server (deploy new applications) after an instance reboot (probably using amazon-ebs)
First check this out if you haven't already ran through it:
http://docs.aws.amazon.com/gettingstarted/latest/awsgsg-intro/intro.html
it'll give you an idea of how it all works.
With regard to running a Java EE app on EC2, you have a couple of choices - but they generally come down to the following recipe:
Start an instance
Install a Java EE application server (tomcat/glassfish/websphere/...)
Install your application (war/ear) into the application server
Now you can bundle the above into an ebs ami, or you can write a script (bash/sh/tcl) which applies those changes when your instance starts (which i prefer). The scripts allow you to modify what gets installed/started/moved around without having to rebundle your instance.
There's some great resources here: http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=100
Hope that helps.
How to deploy a Java EE app on amazon-EC2
You still deploy to an application server so it isn't really different. If you have more specific questions, please clarify. But have a look at Running JEE applications on Amazon EC2 and How to deploy a java web application on an ec2 instance.
Maintain changes to the meta-data of the app server (deploy new applications) after an instance reboot (probably using amazon-ebs)
If you use Amazon EBS, then you don't need to worry, Amazon EBS volumes are off-instance storage that persists independently from the life of an instance.
The Amazon AWS's newly Launched Elastic BeanStalk is here to resolve you concerns.
You can deploy Java EE apps on Amazon Ec2 instances via Bean Stalk. All you need to do is create a new applications and create a environment in it and add you WAR file for deploying, AWS has its own version of Tomcat 6/7 with open JDK which can be customized to Sun JDK if required.
Therefore Amazon offers complete Deployment tool to start using your app by just deploying in BeanStalk. BeanStalk offer Auto Scaling & Elastic Load balancing and a lots more to customize your application Environment.
If you start an ebs-booted instance, you do not need to care about persistency after a reboot (see http://aws.amazon.com/about-aws/whats-new/2009/12/03/amazon-ec2-instances-now-can-boot-from-amazon-ebs/)
Concerning the deployment of Java EE, I don't see any difference to deploying it on a non-virtual OS.
Boxfuse supports deploying Java EE applications using either Tomcat, TomEE Web Profile or TomEE Plus to AWS with a single command
boxfuse run mytomeeapp-1.0.war -env=prod
This will create an image, provision all necessary AWS infrastructure and launch the instances. It supports blue/green zero downtime updates with Elastic IPs and ELBs.
You can find a tutorial here: https://boxfuse.com/blog/javaee-aws.html
You don't have to worry about maintaining changes to the meta-data as all instances are immutable and contain all necessary app server info.
Disclaimer: I am the founder and CEO of Boxfuse

What web server should I use with NetBeans?

I haven't been around Java development for 8 years, but am starting to build a NetBeans Web Application. When I walk through the Web Application wizard, it asks for the server I'm going to be using.
What would be the best and simplest server for me to start using with NetBeans?
Since the NetBeans IDE is a Sun product, I would assume that the Glassfish application server would be a natural fit.
That said, one of the pluses of developing a web application in Java is that the interface for working with the http is standardized (i.e. the Servlet specification), so that you can pick any servlet container you want: be it Glassfish, Tomcat, Jetty or Weblogic. Since it sounds to me that you're experimenting and you want to use something easy to administer, I might go with Glassfish. However, be open to revisit that decision when you need to actually deploy your web application in a production environment. Be sure to check out other options like Tomcat or Jetty.
Unless you are deploying to a full J2EE application server, I would recommend using Tomcat. Tomcat can run as a standalone web/servlet/jsp server and avoids some of the complexities of a full J2EE app server.
The web development bundle for Netbeans will include installers for and automated integration with Glassfish and Tomcat. You will get the "best" experience using Netbeans with those servers.
That said, the workflow in Netbeans can be easily integrated with other application servers. As of 6.1, this includes Sun Java System Application Server 8 and 9, GlassFish v1 and v2, Apache Tomcat 4, 5 and 6, JBoss 4, BEA WebLogic 10, IBM WebSphere 6.0 and 6.1, Sailfin V1. See the Netbeans J2EE Features site for more info.
Glassfish is actually an easy to use app server. I think it's easier for a beginner to use and it's integrated with Netbeans. Setting up database connection caches is easy, for example.
You administer the server through this web page:
http://localhost:4848
(login: admin, password: adminadmin)
Glassfish will run your apps on port 8080.
The Glassfish home page: http://glassfish.dev.java.net (don't really need to read)
For non-Netbeans users there's a QuickStart guide:
http://glassfish.dev.java.net/downloads/quickstart/index.html
Here's a screencast overview:
http://download.java.net/javaee5/screencasts/admin-console/index.html
At some point you will want to learn Tomcat too because it's so prevalent, but Glassfish is a much friendlier start. In fact, it's probably better as a production server too, if you can find an affordable host.

Categories