In the previous tutorial, we have seen how to build CRUD REST APIs using Spring boot, JPA, Hibernate, and MySQL database. In this tutorial, we will learn how to deploy the same Spring Boot MySQL CRUD REST API Application on AWS using Elastic Beanstalk and AWS RDS service.
We use AWS RDS (Amazon Relational Database Service) to deploy MySQL database on AWS cloud.
Amazon Relational Database Service (Amazon RDS) makes it easy to set up, operate, and scale a relational database in the cloud. It provides cost-efficient and resizable capacity while automating time-consuming administration tasks such as hardware provisioning, database setup, patching, and backups. It frees you to focus on your applications so you can give them the fast performance, high availability, security, and compatibility they need.
Read more about RDS at https://aws.amazon.com/rds/
To understand more about this tutorial, I have created a YouTube video on the same topic so I highly recommend you to watch the YouTube video. (YouTube video present at end of this tutorial)
Workflow
So far we have seen how to deploy the Spring boot app on local and connect to the local MySQL database.In this tutorial, we will learn how to deploy the Spring boot app on AWS cloud and connect to the MySQL database which is configured on AWS RDS.
Video
Development Process
- Sign in to AWS Console
- Set up MySQL database in AWS cloud using AWS RDS
- Connect to MySQL database with MySQL workbench to verify the connectivity
- Clone Spring boot application source code from GitHub
- Update application.properties file to change Database MySQL URL property
- Package spring boot application as JAR File
- Deploy Spring boot JRA file on AWS using Elastic beanstalk service
- Test REST APIs using Postman client
1. Sign in to AWS Console
2. Set up MySQL database in AWS cloud using AWS RDS
3. Connect to MySQL database with MySQL workbench to verify the connectivity
4. Clone Spring boot application source code from GitHub
5. Update application.properties file to change Database MySQL URL property
spring.datasource.url = jdbc:mysql://javaguides.ccbtqawd66uq.us-east-2.rds.amazonaws.com:3306/usersDB?useSSL=false spring.datasource.username = root spring.datasource.password = password ## Hibernate Properties # The SQL dialect makes Hibernate generate better SQL for the chosen database spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect # Hibernate ddl auto (create, create-drop, validate, update) spring.jpa.hibernate.ddl-auto = update server.port=5000
Comments
Post a Comment
Leave Comment