Voiced by Amazon Polly
Are you still bound with the platform dependent, large monolithic applications? It is time to get over the legacy applications and to taste the fruit of microservices. You are at the right place to get started with Microservices.
The times of struggling with platform dependent, large monolithic applications have become outdated. Now are the days to start with services that helps us to deploy the same application on various platforms. Here we go with uncovering the edge of Microservices with this article.
Although monolithic application is simple to build, it has huge limitations. Application grows over time and become huge. Every week or month, the development team implements few more lines of code. As time moves, application becomes huge & complicated. It is difficult for a single developer to understand the whole application. Thus, implementing new features and removing bugs is extremely difficult and time consuming. The enormous size of the application holds back the pace of development.
Latest applications are designed in such a way that user can push changes into production multiple times in a day. It is very difficult to do the same with a complex monolithic application.
The basic idea of microservices is to breakdown an application, so that it becomes easier to build, maintain and scale.
Advantages Of Working With Microservices
- Microservices are small and focused on specific requirement
- It can be developed by small teams
- They are loosely coupled that means services are independent of each other in terms of development as well as deployment
- Scaling microservices is very easy
- Microservices allow many ways to integrate automatic deployments by using tools like Jenkins, Bamboo, etc.
- It gives the advantage to use new cutting-edge technologies
- High performance and flexible application
Now we shall go ahead & create a web application which is for compressing images. In this application, first you must register yourself with the application to upload the image for compressing. We will create three microservices: WebMicroservice, RegistrationMicroservice and S3Microservice.
The below diagram will help you to understand the flow of Microservices Application:
Helping organizations transform their IT infrastructure with top-notch Cloud Computing services
- Cloud Migration
- AIML & IoT
- AWS Account with Access Key and Secret Key
- Java 1.8
Task 1: Create WebMicroservice
- Download the WebMicroservice present at
- Open STS and click on File, from the drop-down click on Import, as shown in image below:
- Click on General, from the dropdown. Select Existing Projects into Workspace and then click Next as shown below:
- Click on Select archive file, Select the downloaded archive file, and add this to STS and click on
- Open the application.properties file. Enter Server port for WebMicroservice. Enter RegistrationMicroservice url and S3UploadMicroservice url.
Note: Port number for RegistrationMicroservice and S3UploadMicroservice must be on which you are going to run these services.
- In WebMicroservice, it contains only HTML templates and related class.
- Open DynamodbController.java and check the registerUser() method. In this method, we are sending the RegisterModel object to the RegisterMicroservice Microservice using RestTemplate’s postForObject Http Method.
- Right click on WebMicroservice project and run as a Spring Boot App. Type localhost:<port number> in web browser. Again, you can see registration page.
When you enter all details and click on sign up button you will see the connection refused error because RegistrationMicroservice is not running.
Task 2: Create RegistrationMicroservice
- Download the RegistrationMicroservice present at
- Import RegistrationMicroservice into STS. Follow step 2 to step 7 from Task 1.
- Open the application.properties Enter Access Key, Secret Key, Endpoint, Dynamodbtable name and port.
Note: server.port number must be which you have given in WebMicroservice’s application.properties file’s registration.url
- Open DynamodbController.java class. You are getting the data from WebMicroservice in registeruser() method. Using @ReqestBody you will pass the data in DynamoDBModel class.
Task 3: Create S3Microservice project
- mport S3UploadMicroservice project present at
- Import S3UploadMicroservice into STS. Follow step 2 to step 7 from Task 1.
- Open the properties file. Enter Access Key, Secret Key, Endpoint, bucket name and port.
Note: server.port number must be which you have given in WebMicroservice’s application.properties file’s s3.url
- Open S3UploadMicroservice and Open S3UploadController.java. In imageUpload method you are getting the data from WebMicroservice and Implementing the logic to compress the image.
- Right click on WebMicroservice project and run as Spring Boot App. Run RegistrationMicroservice and S3UploadMicroservice as Spring Boot App.
- Open browser and type http://localhost:WebMicroservicePortNumaber/ then click Enter. Enter Email ID and Password for signup.
- Upload any .jpg image.
- Click on Download to download the compressed image.
Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.
- Cloud Training
- Customized Training
- Experiential Learning
Stay tuned to learn how to deploy these microservices in Docker Containers in my next blog article i.e. Implementation of Microservices with Spring Boot on AWS and in Docker – Part 2
Please feel free to post your views in the comment section below, I will be happy to discuss.
WRITTEN BY Bhavesh Goswami
Bhavesh Goswami is the Founder & CEO of CloudThat Technologies. He is a leading expert in the Cloud Computing space with over a decade of experience. He was in the initial development team of Amazon Simple Storage Service (S3) at Amazon Web Services (AWS) in Seattle. and has been working in the Cloud Computing and Big Data fields for over 12 years now. He is a public speaker and has been the Keynote Speaker at the ‘International Conference on Computer Communication and Informatics’. He also has authored numerous research papers and patents in various fields.