Skip to content

Commit 14bd404

Browse files
szantopeterphilwebb
authored andcommitted
Document AWS Elastic Beanstalk deployment
Update the reference documentation to include details of Amazon Elastic Beanstalk. Closes spring-projectsgh-7948
1 parent fa6a138 commit 14bd404

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

spring-boot-docs/src/main/asciidoc/deployment.adoc

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,88 @@ run the app.
294294

295295

296296

297+
[[cloud-deployment-aws]]
298+
=== Amazon Web Services (AWS)
299+
Amazon Web Services offers multiple ways to install Spring Boot based applications, either
300+
as traditional web applications (war) or as executable jar files with an embedded web
301+
server. Options include :
302+
303+
* AWS Elastic Beanstalk
304+
* AWS Code Deploy
305+
* AWS OPS Works
306+
* AWS Cloud Formation
307+
* AWS Container Registry
308+
309+
Each has different features and pricing model, here we will describe only the simplest
310+
option : AWS Elastic Beanstalk.
311+
312+
313+
314+
==== AWS Elastic Beanstalk
315+
As described in the official http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.html[Elastic
316+
Beanstalk Java guide], there are two main options to deploy a Java application; You can
317+
either us the "`Tomcat Platform`" or the "`Java SE platform`".
318+
319+
320+
321+
===== Using the Tomcat platform
322+
This option applies to Spring Boot projects producing a war file. There is no any special
323+
configuration required, just follow the official guide.
324+
325+
326+
327+
===== Using the Java SE platform
328+
This option applies to Spring Boot projects producing a jar file and running an embedded
329+
web container. Elastic Beanstalk environments run an nginx instance on port 80 to proxy
330+
the actual application, running on port 5000. To configure it, add the following to your
331+
`application.properties`:
332+
333+
[indent=0]
334+
----
335+
server.port=5000
336+
----
337+
338+
339+
340+
===== Best practices
341+
342+
====== Uploading binaries instead of sources
343+
By default Elastic Beanstalk uploads sources and compile them in AWS. To upload the
344+
binaries instead, add the following to your `.elasticbeanstalk/config.yml` file:
345+
346+
347+
348+
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
349+
----
350+
deploy:
351+
artifact: target/demo-0.0.1-SNAPSHOT.jar
352+
----
353+
354+
355+
356+
====== Reduce costs by setting the environment type
357+
By default an Elastic Beanstalk environment is load balanced. The load balancer has a cost
358+
perspective, to avoid it, set the environment type to "`Single instance`" as described
359+
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-create-wizard.html#environments-create-wizard-capacity[in the Amazon documentation].
360+
Single instance environments can be created using the CLI as well using the following
361+
command:
362+
363+
[indent=0]
364+
----
365+
eb create -s
366+
----
367+
368+
369+
370+
==== Summary
371+
This is one of the easiest way to get to AWS, but there are more things
372+
to cover, e.g.: how to integrate Elastic Beanstalk into any CI / CD tool, using the
373+
Elastic Beanstalk maven plugin instead of the CLI, etc. There is a
374+
https://exampledriven.wordpress.com/2017/01/09/spring-boot-aws-elastic-beanstalk-example/[blog]
375+
covering these topics more in detail.
376+
377+
378+
297379
[[cloud-deployment-boxfuse]]
298380
=== Boxfuse and Amazon Web Services
299381
https://boxfuse.com/[Boxfuse] works by turning your Spring Boot executable jar or war

0 commit comments

Comments
 (0)