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

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.

Related

Actions On Google Deployment using webhook

I am using Java Client Library to use google Dialogflow. My questions is what happens when we use "appEnginedeploy" using gradle? Where is the code stored and more importantly how the implemented database and other files of code stored and accessed by our agent?
Thanks!
appEngineDeploy is setup to deploy the code to App Engine, a computing platform on Google Cloud. Code and associated project files are stored as they are in your project.
It's not entirely a VM, so you shouldn't necessarily think of App Engine as locating filepaths. If the project can make the links locally, then it should behave the same way in App Engine.
With regards to databases, it would depend if you're using an embedded database or using a hosted solution through another Google Cloud service. Presumably you'd use the database APIs for a Cloud service as shown in the documentation.

Publish WebService for public access

So, i have some experience developing Java WebServices.
The problem is, all i do is deploy them to localhost.
My question is:
How can we deploy a WebService to a server other than localhost?
How can i search the web and find the WSDL description for my WebService so that i, or anybody else around the world, can call its services?
If i have it in localhost, nobody else but me on my computer can acess it right?...
Thank you for your time
I don't think you'd want to make an application running in your development environment accessible to anybody else around the world for a variety of reasons. Others on your local network could access your local host via its network hostname, but this isn't users around the world.
Let's discuss your two questions individually:
How can we deploy a WebService to a server other than localhost?
You'll want to establish a server environment that is available (on) as much as possible. If you want to keep using Apache Tomcat, you could sign up with a variety of service providers that host Apache Tomcat applications - there are many who offer tiered pricing based on number and size of pre-configured virtual servers (CPU, memory, disk space, and/or monthly data transfer of the application). You could even sign up with a cloud service provider such as Google Cloud, Amazon Web Services, or Microsoft Azure. All provide the tools to build, provision, and manage virtual server(s) which you would then deploy Tomcat and web service application into. Here's a detailed tutorial on setting up a Tomcat virtual server on Azure. You'd then need to manage those server(s), watch them to see how much they're utilized (which will impact how much they cost you per month, by the way).
If server management isn't what you're looking for - you could also explore "serverless" options such as Google AppEngine or AWS Elastic Beanstalk. In this model, you just upload your WAR file and the hosting service manages things like how many servers are needed to handle all the application SOAP requests your users around the world are making. You'll need to read the specifications for each, as you technically aren't providing Tomcat itself - in Google's example, you're actually running in their own proprietary container, so your app may need some changes depending on what it does.
Depending on what hosting or cloud service provider you select, your "how to deploy" steps vary wildly. On the bright side, all offer tutorials on how to specifically deploy applications into them "their way."
How can i search the web and find the WSDL description for my WebService so that i, or anybody else around the world, can call its services?
Once you've settled on a hosting or cloud services provider and have deployed your application, you'll have a URL to reach it, but you'll need to work on getting the word out. There are some open specifications on (SOAP) web service discovery, but more than likely that's not what you're really looking for. You could also submit your WSDL URL to an online API directory such as ProgrammableWeb or Public APIs.
The simplest way to do-it-yourself would be to run a web site that links to the WSDL, then use search engine optimization techniques to list the site on search engines and make it (and the WSDL it links to) relevant to web searches.
Getting fancier, you can treat your web service as a product via an API Management system. At a high level, this works by hiding the real URL to your web service on its server(s) and instead direct clients to a small website for developers where you document, market, facilitate discovery of your service as well as offer a sign up to use it (so you can track and manage who around the world is using your web service). Clients then consume the web service via separate URL behind what's called an API Gateway. You could charge for access or offer it for free but limit the amount of concurrent requests a client can make - after all, you're likely paying your hosting provider for utilization. Some of the cloud service providers Amazon, Azure, standalone API management vendors such as Apigee, Mashery, and many others.

publishing and hosting the webservice on cloud

I have web service that is up and running that is in other words it is publish on my tomat on port 8080 and I can hit it through my browser now I want that my webservice to be get published on cloud so that I can pass wsdl uri to any one in the world and he can access my wsdl. Please advise how to achieve this ..!!will Amazon provide such facilities.
I've tried various options and Amazon's Elastic Beanstalk is the most seamless. You can launch your Java webservice by simply uploading a war. However, it does require an EC2 instance to be running.
Other options are Heroku and Windows Azure
Heroku has a free tier and uses Maven/Git to deploy the app to their server. https://devcenter.heroku.com/articles/deploy-a-java-web-application-that-launches-with-jetty-runner
Windows Azure also has instructions on how to deploy a java webapp on their platform. http://www.windowsazure.com/en-us/develop/java/
Given these options, In my personal opinion, the cheapest is Heroku and the most convinient is Amazon Elastic Beanstalk.

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

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

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

Categories