Spring Cloud Config Server in AWS Lambda - java

I have seen few examples of running spring boot application in AWS Lambda. Is there a way to run Spring Cloud Config Server in AWS Lambda?

It probably doesn't make much sense if you are using config server backed by git or svn since it uses local disk for state in those cases. If you are using jdbc backend, it could work, though I don't know if anyone has tried.

Related

Spring Cloud Config Server with Zookeeper or HashiCorp Vault Backend

My question relates to using either Zookeeper or Hashicorp's Vault as a back-end data store to Spring's Cloud Config Server.
We're currently running a number of Spring Boot micro-services that rely on a Spring Config Server to serve each service's configuration. This works well and we have no issues with it.
Initially, config server ran on the native profile and had the config files embedded in the application. This doesn't work as each time we make a configuration change to any of the applications we needed to redeploy config-server.
Using GIT is obviously more robust and we were in the process of switching to a standalone GIT backend when we were asked to look into using Zookeeper or Vault instead.
Which brings me the question:- is it at all possible to use Vault/Zookeeper as the back-end data store for Config Server without needing each application to talk to Vault/Zookeeper directly?
Thanks
Yes, it's possible to use a different backend (like Vault or SVN, called EnvironmentRepository) in Spring Cloud Config without touching your clients.
See the reference docs on more details.
To update this:
We switched out the Zookeeper backend for Consul instead as we were able to use SSL for the connection between Vault and Consul. This isn't currently available when using Zookeeper as the storage backend.
We now have a working configuration stack comprising of Consul, Vault and Spring Cloud Config Server with SSL enabled between all three. Additionally, Consul and Vault are both running in a clustered mode with replication between all nodes in the cluster.
Working well thus far.

Extending Spring Cloud - Cloud Platform Extensibility

After reading the following post I have a few questions:
https://spring.io/blog/2014/08/05/extending-spring-cloud
Imagine that I have implemented my own Spring Cloud (Cloud Platform Extensibility), and after testing in my local machine I want to deploy in different environments.
Assume that:
My environments have a Docker installation.
I do not want to install the Cloud Foundry architecture in them.
My questions are:
What are the requirements for the different environment to work with my own Spring Cloud? i.e. must I install Spring Cloud Foundry architecture in all the environment machines?
Is Spring Cloud Foundry archictecture compulsory though I have implemented my custom Spring Cloud?
Must I use commands like "cf" to upload and deploy the services?
Many thanks.
Regards,
Paco.
That is an old blog post and I feel it doesn't accurately describe Spring Cloud as it stands today. It refers to the since renamed Spring Cloud Connectors project.
Spring Cloud, built on top of Spring Boot, provides developers an easy way of building "cloud native" and "12 factor" applications. That essentially boils down to the common patterns found in modern applications such as centralized configuration, service discovery, circuit breakers, etc. This is cloud agnostic and works well in a variety of environments including AWS and GCP.
So no, Spring Cloud isn't really directly related to Cloud Foundry, however it works nicely there as it does many other places.
You probably solved your problem, but in case not and for the sake of others i'll post an answer. You can deploy a spring cloud application on docker swarm using docker compose v3 . As shown in this repository , the command docker stack deploy -f all-in-one.yml springcloud deploys the resource specified in all-in-one.yml on docker swarm. You can take a look at how docker stack works in this documentation.

How to deploy java spring restful service on AWS based on tomcat server with mysql database?

I have restful spring web service running on tomcat server and have mysql database on backend. I deployed war file of my service using aws elastic beanstalk free account yet but I am unable to setup mysql database. Can anyone guide me on this matter ? Secondly, our application has android side code which will call my REST API so is there any other way to do this instead of setting up amazon web services for testing purposes ?
You are going the right way; Android should call REST APIs. These APIs can be implemented in following ways:
As you suggested; use spring on tomcat to expose such apis.
Use API Gateway exposed by AWS. This api gateway can even call lambda expressions in backend which can be written in Java/Python etc.
I will suggest you to go ahead with 1 as u are already aware of spring/tomcat etc. and MOST companies use this only.
For MySQL database you have following options:
Install MySQL on your local EC2 server ( where you have tomcat running ); or on another EC2 server.
You can use MySQL as a service which is RDS. It is expensive but easy to configure.

Binding Java application to MySQL in Cloud Foundry

I'm trying to bind MySQL service, which is in on prem cloud foundry, to my Java application. could anyone suggest me what are the necessary changes to be made in my code to access MySQL database.
If you are using Spring Boot, this should happen almost automatically as described in a Spring blog post.
If you are using Spring without Spring Boot, you may want to use Spring Cloud Connectors.
If you are using neither, you can interrogate the VCAP_SERVICES environment variable for details of your service.
On cloud foundry, you will have to provision a service for your app.
Look for available services.
cf marketplace
Identify the mysql service and the plan. Create the service instance
cf create-service p-mysql 512mb mysql
To see the service instances
cf services
Bind the service instance to your app
cf bind-service myapp mysql
You can see the details as
cf env myapp
EngineerBetter has already provided you articles on how to use Spring to leverage the service in your app code.
Here's a good quick reference for CF CLI

Amazon AWS WebApp with MongoDB

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.

Categories

Resources