Deploy a Java EE Application on AWS Elastic Beanstalk Using Docker Containers
SPL-49 - Version 3.6.5
© 2018 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may not be reproduced or redistributed, in whole or in part, without prior written permission from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
Errors or corrections? Email us at email@example.com.
Other questions? Contact us at https://aws.amazon.com/contact-us/aws-training/
This lab leads you through the steps to:
- Install a Java EE application into JBoss WildFly, running in a custom Docker Container,
- Deploy your container to AWS Elastic Beanstalk.
When deploying Docker containers to AWS, you have the choice between deploying to stand alone Amazon EC2 instances or deploying to AWS Elastic Beanstalk. The later will automatically create the infrastructure required to run, to scale and to monitor your application. Amongst other advantages, AWS Elastic Beanstalk will automatically create the following components for you:
- One or multiple Amazon EC2 instances,
- An auto-scaling configuration,
- An Elastic Load Balancer.
This lab will provide you with an Amazon EC2 instance that you will use to prepare your Docker container before deploying it to AWS Elastic Beanstalk. This approach was used to ensure that the required dependencies were available and pre-installed for you, letting you focus on the Docker, JBoss WildFly and AWS Elastic Beanstalk parts, not on the work environment itself. Dependencies installed at lab start time are Python 2.7 and AWS Elastic Beanstalk command line tool (eb).
This work environment is name “Docker Host” in Amazon EC2 console.
By the end of this lab, you will be able to:
- Install Docker on an Amazon EC2 instance
- Create and customize a Docker Container
- Deploy an application to a Docker Container
- Test an application running in a Docker Container
- Configure AWS Elastic Beanstalk to deploy Docker Containers
- Use AWS Elastic Beanstalk to deploy Docker Containers
- Use AWS Elastic Beanstalk to collect and analyze logs from your Docker container and your application
- Push your application’s updates to AWS Elastic Beanstalk using the eb command
Technical Knowledge Prerequisites
To successfully complete this lab, you should be familiar with basic Linux server administration and comfortable using the Linux command-line tools. You also should have basic understanding of web applications, Java web application servers and networking, such as TCP port, HTTP Proxy, Load Balancers etc.
PuTTY is a Windows command line SSH client. When running on Windows, PuTTY will allow you to start an SSH connection to the Amazon EC2 instance we will use as workbench in this lab.
If you do not already have the PuTTY client installed on your machine, you can download and then launch it from here:
If you are running this Lab from an Apple Mac OS X or Linux machine, you do not need to download PuTTY.
Docker is an open platform for developing, shipping, and running applications. Docker is designed to deliver your applications faster. With Docker you can separate your applications from your infrastructure and treat your infrastructure like a managed application. Docker helps you ship code faster, test faster, deploy faster, and shorten the cycle between writing code and running code. Docker does this by combining a lightweight container virtualization platform with workflows and tooling that help you manage and deploy your applications.
At its core, Docker provides a way to run almost any application securely isolated in a container. The isolation and security allow you to run many containers simultaneously on your host. The lightweight nature of containers, which run without the extra load of a hypervisor, means you can get more out of your hardware.
Surrounding the container virtualization are tooling and a platform, which can help you in several ways:
- Getting your applications (and supporting components) into Docker containers
- Distributing and shipping those containers to your teams for further development and testin
- Deploying those applications to your production environment, whether it be in a local data center or the Cloud
A Docker Container
A Docker container is similar to a directory. A Docker container holds everything that is needed for an application to run. Each container is created from a Docker image. Docker containers can be run, started, stopped, moved, and deleted. Each container is an isolated and secure application platform. Docker containers are the run component of Docker.
A container consists of an operating system, user-added files, and metadata. Each container is built from an image. That image tells Docker what the container holds, what process to run when the container is launched, and a variety of other configuration data. The Docker image is read-only. When Docker runs a container from an image, it adds a read/write layer on top of the image (using a union file system) in which your application can then run.
With AWS Elastic Beanstalk, you can quickly deploy and manage applications in the AWS Cloud without worrying about the infrastructure that runs those applications. AWS Elastic Beanstalk reduces management complexity without restricting choice or control. You simply upload your application, and AWS Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring.
Notice the lab properties below the lab title:
- setup - The estimated time to set up the lab environment
- access - The time the lab will run before automatically shutting down
- completion - The estimated time the lab should take to complete
- At the top of your screen, launch your lab by clicking
If you are prompted for a token, use the one distributed to you (or credits you have purchased).
A status bar shows the progress of the lab environment creation process. The AWS Management Console is accessible during lab resource creation, but your AWS resources may not be fully available until the process is complete.
- Open your lab by clicking
This will automatically log you into the AWS Management Console.
Please do not change the Region unless instructed.
Common login errors
Error : Federated login credentials
If you see this message:
- Close the browser tab to return to your initial lab window
- Wait a few seconds
- Click again
You should now be able to access the AWS Management Console.
Error: You must first log out
If you see the message, You must first log out before logging into a different AWS account:
- Click click here
- Close your browser tab to return to your initial Qwiklabs window
- Click again
Join Qwiklabs to read the rest of this lab...and more!
- Get temporary access to the Amazon Web Services Console.
- Over 200 labs from beginner to advanced levels.
- Bite-sized so you can learn at your own pace.