Amazon Web Services offers multiple ways to install Spring Bootbased applications, either
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. Options include :
server. The options include:
* AWS Elastic Beanstalk
* AWS Code Deploy
...
...
@@ -250,29 +254,29 @@ server. Options include :
* AWS Cloud Formation
* AWS Container Registry
Each has different features and pricing model, here we will describe only the simplest
option : AWS Elastic Beanstalk.
Each has different features and pricing model. In this document, we describe only the
simplest option: AWS Elastic Beanstalk.
==== AWS Elastic Beanstalk
As described in the official http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.html[Elastic
Beanstalk Java guide], there are two main options to deploy a Java application; You can
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 producing a war file. There is no any special
configuration required, just follow the official guide.
===== Using the Tomcat Platform
This option applies to Spring Boot projects that produce a war file. There is no any special
configuration required. You need only follow the official guide.
===== Using the Java SE platform
This option applies to Spring Boot projects producing a jar file and running an embedded
===== 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 to your
`application.properties`:
the actual application, running on port 5000. To configure it, add the following line to
your `application.properties` file:
[indent=0]
----
...
...
@@ -280,12 +284,12 @@ the actual application, running on port 5000. To configure it, add the following
----
===== Best practices
====== Uploading binaries instead of sources
By default Elastic Beanstalk uploads sources and compiles them in AWS. To upload the
binaries instead, add the following to your `.elasticbeanstalk/config.yml` file:
[TIP]
.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 the following lines to your
`.elasticbeanstalk/config.yml` file:
...
...
@@ -294,28 +298,30 @@ binaries instead, add 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 cost
perspective, to avoid it, set the environment type to "`Single instance`" as described
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-create-wizard.html#environments-create-wizard-capacity[in the Amazon documentation].
Single instance environments can be created using the CLI as well using the following
command:
[TIP]
.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