Amazon AWS WebApp with MongoDB - java

I have built a mobile application that needs to connect to my SpringBoot-WebApp which in turn has a MongoDB and some other things in the background.
I want to deploy this WebApp at Amazon AWS, but I am overwhelmed by all the possibilities. So far, I have just created it as a .jar, and ran it that way, and it worked fine at my other server.
Now, for traffic reasons and such, we want to move it to AWS. I have found out, that I need to create a .war instead of a .jar, which is not a problem. I then learned to upload this .war to Elastic Beanstalk. However, my application needs to connect to a MongoDB. I have logged on to AWS via SSH and installed MongoDB there and created the database, but it does not seem like this is the right way to do it.
It'd greatly appreciate if anyone could give me a hint on how to do this as I am very confused.
Thanks and best regards!

It isn't clear if you are doing this, but don't run MongoDB on Elastic Beanstalk. The Elastic Beanstalk server you have it installed on may be automatically deleted by AWS. In general you do not want to manually install anything on Elastic Beanstalk as it is a managed environment where servers may be automatically created or deleted based on server load.
Amazon doesn't provide a MongoDB service directly, so you either need to install and manage MongoDB on an EC2 instance (or fleet of instances) yourself, or use a third party MongoDB service that runs on AWS. You could use something like MongoLab which provides a MongoDB service that runs on AWS. This allows your network traffic between your web servers and database servers to stay within the AWS network, which you will want for both performance and security reasons.
If you use MongoLab just make sure you choose to create your database in the same AWS region that you are deploying your application to. Also, I wouldn't recommend their free sandbox databases for any sort of critical production application.
If you decide to install and manage MongoDB on AWS yourself, here is some documentation from Amazon, and some from MongoDB.

Related

Deploying Spring-React-SQL web application

I would like to make web application based on Spring REST with SQL db and React frontend.
While it's OK for me, to deploy it locally, I don't really know, how to make it visible on public website. I thought of Azure, AWS, Google Cloud, but I cannot find any sufficient information.
Should I run frontend and backend on two independent Web apps? If so, how would I make them communicate?
Thanks for any replies!
If you are using AWS cloud, You can make it public using aws cloudfront which serves static content from s3. You just need to upload your react build on s3 and you can host via cloudfront.
For your spring rest service you can deploy your .war Or .jar on AWS Elastic beanstalk(EBS).
Your database should be on AWS RDS
Using those service you can ealsy host your website with react frontend, spring rest services and database handling
Front-end will make REST API calls to your backend to fetch/retrieve or to send data. This is usually the way frontend communicates with backend.
In order to make your applications accessible to the public over internet, you will need an external IP address.
Your backend and frontend applications may use the same IP but different port and access paths.
You might also need to have a domain name and DNS setup against your ip.
Backend will be deployed independently of frontend and you can have both of them running on same machine.
You can start your Backend as a Spring Boot Application on any standard port available. [default is 8080].
Same can be looked up by your React Frontend using process.env.API_URL.
Below article from DZone is a rich source of information.
https://dzone.com/articles/integrating-spring-boot-and-react-with-spring-secu-1
Also to achieve the same, you can try a simple combination of AWS EC2 & RDS combination to start with and enhance it as per requirement.

Where can I deploy my java REST webservice for free so that I can access it remotely?

I have developed a REST web-service in Java interacting with a MySQL database.I want to deploy the web-service and the create a database at a server so that I can invoke it from an application.I tried Microsoft Azure but was unable to get it done.Where can I find relevant information for this?
I had similar problems with a MySQL database using the third party option in the Azure Marketplace from ClearDb. What I ended up doing was switching my database from a MySQL instance to an Azure Database Instance (Subset of SQL Server's features.) This worked perfectly for me! I was able to query from my database feed data to my api, and access the API through my Azure Web App.
I understand this may not be an option for you, however, Digital Ocean is a great cloud hosting option (with scaling similar to Azure, although not as good in my honest opinion.) You can set up a Linux Environment with a MySQL Server and JVM and serve your whole API through there. Best of Luck!
#coderden, According to your description, I think you have been deployed your Java Application on an Azure WebApp. Then when you created a MySQL database on Azure for connection from the Java webapp, please make sure the webapp & mysql instance created in a same resource group and note the connection string of MySQL on Azure.
As reference, please see the article to try again although it's for PHP, the steps are the same for Java.

Setup web service using Amazon AWS and tomcat

I am pretty new to Amazon AWS technologies, and I have been going through all their documentation. My goal is to create a new web service for a use case (preferably REST) using Tomcat.
I want to use this service in multiple clients like Android, Iphone, Tablet, Web etc.
Some of the examples I want to support are like -
GET http://myservice.com/user/{userid}
PUT http://myservice.com/user/{user-data}
Does AWS or any other cloud service providers provide anything out of the box for deploying such services with minimal code changes?
With AWS, you create a virtual server, customize it, and then use it. When you create a server, you pick your operating system and the size of the server you need. Once it is running, you can login and customize it.
For example, you might start a linux server using the Amazon Linux AMI (amazon machine image). You can use yum to install tomcat. You can drop your war file into the tomcat webapps directory.
Set up access in the security group (firewall) to allow your clients to access the relevant port(s).
Bottom line is that the process is basically the same as if you are doing this on a new server of your own.

How to deploy java application to EC2 like Heroku?

I really like Heroku style to commit the code and everything is deployed to the server. However, I'm building a java webservice which requires read/write file system. So, heroku is not the best option for me. So, I think my best option would be to host it on EC2. However, I want to setup something like when I committed the code and push to Github it also pushes to EC2 server as well.
So, Github would be just a source control, but the server is on EC2. How can I achieve that?
You could use AWS Elastic Beanstalk, which manages server/app container for you.
You can find more information here: http://aws.amazon.com/elasticbeanstalk/
Yes. Java on Play or Spring stack for example can run on Heroku.
Check this article to view all the stacks supported by Heroku.

Server to run java servlet

I'am developing a java servlet application, and tesing it on Eclipse + Apache Tomcat (refer: http://www.vogella.de/articles/EclipseWTP/article.html#overview_wtp).
The application is now tested on the localhost and accesed by any clients on the same LAN.
Now, I need to deploy it into the web server, where everyone from anywhere can access this servlet.
Coud you guide me the way that I've to do to archive this task.
You need to have a computer accessible to everyone - i.e. placed on the internet and not behind a firewall - with the appropriate software installed (and hardened against hacker attacks).
If you do not have such a computer, you can have a look at the Google Application Engine which allows you to deploy Java web applications (with some additional restrictions) to the Google cloud. This is free for low-volume applications.
Yes, you can do it by deploying your application in the Cloud Instance. Since we cannot able to make our server instance or computer to be run always(We may come across internet connection problems, Power Fluctuation, etc.,), We have lot of problems while making our instance public(In Security perspective too). So it is better to use cloud instances.
We have many Cloud Service Providers such as AWS by Amazon, Google Cloud, Microsoft Cloud, etc.,
Take a look on this List of Cloud Services Providers.(You have links for all top 10 providers)

Categories

Resources