You are on page 1of 20

JSS Mahavidyapeetha

JSS Science and Technology University,


Mysuru 570 006

“SPRING BOOT WEB APP


DEPLOYMENT IN AWS USING EC2”
A report submitted for partial fulfilment of the course(Event)

CLOUD COMPUTING AND VIRTUALIZATION


[LNI152]
Submitted by

USN Name
01JST20PNI003 Darshan M S
01JST20PNI013 Tejas Kumar M
01JST20PNI015 Varshad V

Under the guidance of


Prof. Vinay Prasad M S
Assistant Professor
Dept. of EC&E, JSSSTU Mysore

Department of Networking and Internet Engineering


April 2021
Abstract

The Spring PetClinic was created in 2003 by Kren Krebs and Juergen Hoeller who are
developing the first version of the Spring Framework (released in march 2004). This
sample application was a kind of tutorial, a demonstration of what it was possible to
conceive. It was distributed with the Spring Framework until the 2.5 version (2007).
Petclinic is a Spring Boot application built using Maven. By building a jar file and
running it from the command line and deployment of app to AWS using EC2 service.
Contents

1 INTRODUCTION 3
1.1 Spring Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Apache Maven . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Elastic Compute Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 SYSTEM REQUIREMENTS 5
2.1 The System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 TECHNOLOGIES USED 6
3.1 Spring Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Github . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Apache 2.0 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.4 Maven . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.5 Elastic Compute Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4 IMPLEMENTATION 9

5 RESULTS 15

6 CONCLUSION 17

1
List of Figures

3.1 Spring Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6


3.2 Github . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

4.1 GitHub Deploy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9


4.2 EC2 Instance Launch Step 1 . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3 EC2 Instance Launch Step 2 . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.4 EC2 Instance Launch Step 3 . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.5 EC2 Instance Launch Step 4 . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.6 EC2 Instance Launch Step 5 . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.7 EC2 Instance Launch Step 6 . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.8 EC2 Instance Launch Step 7 . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.9 EC2 Instance Launch Step 8 . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.10 Amazon Linux 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.11 Amazon Linux 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.12 Amazon Linux 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.13 Amazon Linux 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5.1 Launching PetClinic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15


5.2 Home Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.3 Add Owner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.4 Details of Owner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2
Chapter 1

INTRODUCTION

The Spring PetClinic was created in 2003 by Kren Krebs and Juergen Hoeller who are
developing the first version of the Spring Framework (released in march 2004). This
sample application was a kind of tutorial, a demonstration of what it was possible to
conceive. It was distributed with the Spring Framework until the 2.5 version (2007).
At this time, the Spring ecosystem was growing: Spring Batch, Spring Web Services,
Spring Security. . . The PetClinic development was in stand-by. The Spring community
likes demo application. It was missing. So in 2013, Keith Donald, Michael Isvy and
Costin Leau has decided to migrate the source code of PetClinic to GitHub and Spring
Framework 3. PetClinic relives. In 2016, PetClinic switched to Spring Boot. Dave Syer
and Stéphane Nicoll took the leadership. In parallel, Antoine Rey centralized all forks of
Spring PetClinic into a GitHub Organization

1.1 Spring Framework


The Spring Framework is an application framework and inversion of control container for
the Java platform. The framework’s core features can be used by any Java application,
but there are extensions for building web applications on top of the Java EE (Enterprise
Edition) platform. Although the framework does not impose any specific programming
model, it has become popular in the Java community as an addition to the Enterprise
JavaBeans (EJB) model. The Spring Framework is open source.

1.2 Apache Maven


Apache Maven is a software project management and comprehension tool. Based on the
concept of a project object model (POM), Maven can manage a project’s build, reporting
and documentation from a central piece of information.

3
1.3. ELASTIC COMPUTE CLOUD CHAPTER 1. INTRODUCTION

1.3 Elastic Compute Cloud


The deployment of the spring application is using Amazon Web Services service which
is Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity
in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need
to invest in hardware up front, so you can develop and deploy applications faster. You
can use Amazon EC2 to launch as many or as few virtual servers as you need, configure
security and networking, and manage storage. Amazon EC2 enables you to scale up or
down to handle changes in requirements or spikes in popularity, reducing your need to
forecast traffic.

4
Chapter 2

SYSTEM REQUIREMENTS

This chapter discusses the requirements of the system, including hardware and software
requirements.

2.1 The System


Through this chapter and rest of the report, the meaning of the system is as follows.
System includes the software for Spring Boot Web App Deployment and user interface.
System in the current context does not include any hardware.

2.2 Requirements
We identify following requirements for the system.
1. Operating system : This project is developed in a system running Windows
operating system. It can run on any other operating system which supports the
tools and technologies mentioned in the next section.

2. Java : The implementation is done using JAVA language using Maven. JAVA
is a high-level, interactive and object-oriented language. JAVA is designed to be
highly readable. It uses English keywords frequently where as other languages use
punctuation, and it has fewer syntactical constructions than other languages. JAVA
features a dynamic type system and automatic memory management(Garbage Col-
lection). It supports multiple programming paradigms, including object-oriented,
functional and procedural, and has a large and comprehensive standard library

3. Elastic Compute Cloud (EC2):

• Standard or Basic Configurations in launching EC2 Instance


• Amazon Linux 2 AMI
• Github
• Corretto 11 OpenJDK JAVA Installation

5
Chapter 3

TECHNOLOGIES USED

3.1 Spring Framework

Figure 3.1: Spring Framework

The Spring PetClinic is a sample application designed to show how the Spring stack
can be used to build simple, but powerful database-oriented applications.
The official version of PetClinic demonstrates the use of Spring Boot with Spring
MVC and Spring Data JPA.
The Spring Framework is an application framework and inversion of control container
for the Java platform. The framework’s core features can be used by any Java application,
but there are extensions for building web applications on top of the Java EE (Enterprise
Edition) platform. Although the framework does not impose any specific programming
model, it has become popular in the Java community as an addition to the Enterprise
JavaBeans (EJB) model. The Spring Framework is open source.

6
3.2. GITHUB CHAPTER 3. TECHNOLOGIES USED

3.2 Github

Figure 3.2: Github

There are quite a lot of forks in a special GitHub organization named spring petclinic
with different:
• Language: Java, TypeScript, Kotlin
• Frontend: Angular, React, JSP, Thymeleaf
• Persistence: Spring Data, Hibernate, Spring JDBC
• Architecture: monolith vs microservices
• REST API: GraphQL, Spring MVC

3.3 Apache 2.0 License

Figure 3.3: Apache

All PetClinic versions are Open Source software released under the Apache 2.0 license.
PetClinic has an active developer community passionate about Spring technologies.

3.4 Maven
Apache Maven is a software project management and comprehension tool. Based on the
concept of a project object model (POM), Maven can manage a project’s build, reporting
and documentation from a central piece of information.

7
3.5. ELASTIC COMPUTE CLOUD CHAPTER 3. TECHNOLOGIES USED

3.5 Elastic Compute Cloud


Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity
in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need
to invest in hardware up front, so you can develop and deploy applications faster. You
can use Amazon EC2 to launch as many or as few virtual servers as you need, configure
security and networking, and manage storage. Amazon EC2 enables you to scale up or
down to handle changes in requirements or spikes in popularity, reducing your need to
forecast traffic. Features of Amazon EC2:

• Virtual computing environments, known as instances

• Preconfigured templates for your instances, known as Amazon Machine Images


(AMIs), that package the bits you need for your server (including the operating
system and additional software)

• Various configurations of CPU, memory, storage, and networking capacity for your
instances, known as instance types

• Secure login information for your instances using key pairs (AWS stores the public
key, and you store the private key in a secure place)

• Storage volumes for temporary data that’s deleted when you stop, hibernate, or
terminate your instance, known as instance store volumes

• Persistent storage volumes for your data using Amazon Elastic Block Store (Ama-
zon EBS), known as Amazon EBS volumes

• Multiple physical locations for your resources, such as instances and Amazon EBS
volumes, known as Regions and Availability Zones

• A firewall that enables you to specify the protocols, ports, and source IP ranges
that can reach your instances using security groups

• Static IPv4 addresses for dynamic cloud computing, known as Elastic IP addresses

• Metadata, known as tags, that you can create and assign to your Amazon EC2
resources

• Virtual networks you can create that are logically isolated from the rest of the AWS
Cloud, and that you can optionally connect to your own network, known as virtual
private clouds (VPCs)

8
Chapter 4

IMPLEMENTATION

1. GitHub code push to GitHub repository

Figure 4.1: GitHub Deploy

2. AWS EC2 Launching an Instance [Amazon Linux 2 AMI]

• EC2 Step 1

Figure 4.2: EC2 Instance Launch Step 1

9
CHAPTER 4. IMPLEMENTATION

• EC2 Step 2

Figure 4.3: EC2 Instance Launch Step 2

• EC2 Step 3

Figure 4.4: EC2 Instance Launch Step 3

10
CHAPTER 4. IMPLEMENTATION

• EC2 Step 4

Figure 4.5: EC2 Instance Launch Step 4

• EC2 Step 5

Figure 4.6: EC2 Instance Launch Step 5

11
CHAPTER 4. IMPLEMENTATION

• EC2 Step 6

Figure 4.7: EC2 Instance Launch Step 6

• EC2 Step 7

Figure 4.8: EC2 Instance Launch Step 7

• EC2 Step 8

Figure 4.9: EC2 Instance Launch Step 8

12
CHAPTER 4. IMPLEMENTATION

3. Connect to Instance and Check for Updates

Figure 4.10: Amazon Linux 2

4. Update

Figure 4.11: Amazon Linux 2

5. Make a Directory

Figure 4.12: Amazon Linux 2

6. Java Installation

• sudo yum install java-11-amazon-corretto


• sudo alternatives –config java
• OpenJdk JAVA

Figure 4.13: Amazon Linux 2

13
CHAPTER 4. IMPLEMENTATION

7. Github Clone the Repository into Amazon Linux

• git clone https://github.com/spring-projects/spring-petclinic.git


• cd spring-petclinic

8. java -jar target/*.jar

Note: To push code to github

• echo ”# Spring-Boot” README.md

• git init

• git add *

• git commit -m ”first commit”

• git branch -M main

• git remote add origin https://github.com/cloud-event/spring-boot.git

• git push -u origin main

14
Chapter 5

RESULTS

Figure 5.1: Launching PetClinic

Figure 5.2: Home Page

15
CHAPTER 5. RESULTS

Figure 5.3: Add Owner

Figure 5.4: Details of Owner

16
Chapter 6

CONCLUSION

Petclinic is a Spring Boot application built using Maven.We were able to build a jar file
and run it from the command line and deployment of dynamic web app to AWS using
EC2 service and modification of details of owner has been done successfully .

17
Bibliography

[1] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html

[2] https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/amazon-linux-
install.html

[3] https://mvnrepository.com/artifact/org.springframework

[4] https://github.com/spring-projects/spring-petclinic

[5] https://github.com/in28minutes/spring-boot-examples

18

You might also like