How to run an application that uses aws Service Discovery locally? - java

I'm currently trying to create an application that have some separated micros-services and they need to communicate between them.
The problem is: I want to deploy the complete application to aws, using ECS, ECR, and mainly using AWS Service Discovery.
The application runs ok on the cloud, but how to run it locally?
My initial thoughts tends towards something like choosing between using the Service Discovery when on the cloud or using something like Eureka locally.

Related

Deploying springboot app and ui separately

Currently, I have a springboot jar file with a bunch of rest and apis including calls for login deployed on ec2. I also have a separate code base for my ui i.e with js,html,css. What is the best way to deploy this on aws and keep it separate from the backend.
This can be done in many ways. But will share a simple way.
Deploy your spring boot app in one aws instance.
Deploy the other front end app on the other aws instance.
This is a kind of two tier application where the server and client app are hosted in different instance. You can restrict the access of your rest api to be accessed only by the instance where you host front end app. For trial you can use heroku account. E.g.
Github: https://github.com/krishna28/springbootapi
Also check https://github.com/krishna28/etodo

REST API AWS cloud using java

I am new to AWS , want to develop a cloud ready java application REST API.
The application will hit the MySQL database and produce output as JSON after querying the database.
IP:port/application?q=<query> response is JSON.
How to achieve it ? the data in MySQL is mostly static 100MB data but used very frequently.
It is very straight forward. if you already have same application running in your local system , then you can just move it to AWS , using below steps :-
spin up new ec2 instance, if you are using a free-tier then you can spin up lots of AWS resources for free , more information on https://aws.amazon.com/free/ .
install all the required s/w like Java, maven , tomcat and mysql and whatever your application is using on Ec2 instance . you can even have a free RDS (Database) instance in free tier which you can use for your application , instead of having the database installed locally on your application server.
while creating the ec2 server , configure instance security group properly for ex 8080 for http and 22 for SSH , 3306 for mysql etc. (This is important and try to be as restrtict as possible to make it safe from hackers).
build and deploy your application and access it using any REST client , by giving instance ip and application port number.
There are several resources online for AWS , you can refer https://www.youtube.com/watch?v=oS7VYX7LXUo which talks about deploying a java application to AWS.
Let me know if you need any other information.
Deploying Java apps (for example, a Spring BOOT APP) that interacts with the Amazon Relational Database Service (Amazon RDS) to the cloud is easy when using Elastic Beanstalk. An example of a Spring Boot database application that queries data from MySQL running on the cloud is documented here: https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/javav2/usecases/creating_secure_spring_app

Spring Cloud Starter Eureka without a webserver

Is it possible to run an eureka client without running a webserver? The 'spring-cloud-starter-eureka' artifact automatically pulls in 'spring-boot-starter-web'. Why is that? Is it possible to run the client without actually starting up a webserver?
My problem is that starting up a webserver eats up around ~200mb of ram. This is a problem because the memory allocated for the apps I want to use eureka with is ranging from 256-512mb.
It seems you don't need this service of yours to serve web request but still need the it to access your eureka server.
So disable web from the application.
spring.main.web-environment=false
And use the Discoveryclient to fetch the services.
If that is not good enough then remove eureka dependency and Make a rest call using (RestTemplate) to your eureka server to query for the services you need. Eureka exposes a rest endpoint for this. So it can't be used by even non-java/jvm based applications.
You could take a look at this project I wrote some time ago to see how to do this.
If that is not good enough still. Then you might have to write plain java code which you should be writing in the first place unless you have a reason to be using a framework such as spring (Transaction,JPA, web, security etc).

Is it possible to start/stop a Falcor (NodeJS) app through its Sidecar Java Spring service?

I am setting up a test Java Spring environment using Netflix OSS software. Included in this I have the Eureka Discovery server, a basic test microservice and a Sidecar service that connects to a Falcor NodeJS service.
These services will need to be started/stopped by a deployment system that only knows how to kill Java apps. Is it possible to kill the NodeJS app through the Sidecar instance? If so, how?
Thanks
The sidecar is not designed to start or stop processes. It is only there to register one, and provide health checks etc. You will need some other supervisor-type system to manage the lifecycle of your apps.

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.

Categories