2020-02-16

Spring - Amazon Web Services (AWS)

Amazon Web Services (AWS)

Amazon Web Services offers multiple ways to install Spring Boot-based applications, either as
traditional web applications (war) or as executable jar files with an embedded web server. The
options include:

• AWS Elastic Beanstalk
• AWS Code Deploy
• AWS OPS Works
• AWS Cloud Formation
• AWS Container Registry

Each has different features and pricing models. In this document, we describe only the simplest
option: AWS Elastic Beanstalk.

AWS Elastic Beanstalk

As described in the official Elastic Beanstalk Java guide, there are two main options to deploy a Java
application. You can either use the “Tomcat Platform” or the “Java SE platform”.
Using the Tomcat Platform
This option applies to Spring Boot projects that produce a war file. No special configuration is
required. You need only follow the official guide.
Using the Java SE Platform
This option applies to Spring Boot projects that produce a jar file and run an embedded web
container. Elastic Beanstalk environments run an nginx instance on port 80 to proxy the actual
application, running on port 5000. To configure it, add the following line to your
application.properties file:

server.port=5000

Upload binaries instead of sources
By default, Elastic Beanstalk uploads sources and compiles them in AWS. However,
it is best to upload the binaries instead. To do so, add lines similar to the following
to your .elasticbeanstalk/config.yml file:

deploy:
 artifact: target/demo-0.0.1-SNAPSHOT.jar

Reduce costs by setting the environment type
By default an Elastic Beanstalk environment is load balanced. The load balancer
has a significant cost. To avoid that cost, set the environment type to “Single
instance”, as described in the Amazon documentation. You can also create single
instance environments by using the CLI and the following command:

eb create -s


1 comment:

  1. This is a wonderful article, Given so much information in it, These type of articles keeps the user's interest in the website, and keep on sharing more ... good luck.
    AWS Training Hyderabad/
    AWS Course Hyderabad/
    AWS Training Institutes Hyderabad/
    AWS Online Training Hyderabad/

    ReplyDelete