Migrate from Oracle GlassFish to AWS Elastic Beanstalk - AWS Prescriptive Guidance

Migrate from Oracle GlassFish to AWS Elastic Beanstalk

Created by Sandeep Bondugula (AWS)

Environment: PoC or pilot

Source: Application Development

Target: AWS Elastic Beanstalk

R Type: Rehost

Workload: Open-source; Oracle

Technologies: Migration; Containers & microservices; Web & mobile apps

AWS services: AWS Elastic Beanstalk


This pattern describes how to migrate a Java application running on an on-premises Oracle GlassFish server to AWS Elastic Beanstalk in the AWS Cloud. 

On AWS, the Java application is deployed on a Docker GlassFish server with AWS Elastic Beanstalk, which runs in an Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling group. 

Additional features:

  • Amazon Elastic Beanstalk acts as a wrapper for several underlying resources. It sets up Elastic Load Balancing (which handles incoming traffic from Amazon Route 53), disperses the traffic to one or more EC2 instances, and also serves as a deployment tool.

  • To migrate an on-premises database to Amazon Relational Database Service (Amazon RDS), update the database connection details. In the backend database, you can configure Amazon RDS Multi-AZ deployments and choose the database engine type. 

  • You can use Multi-AZ deployment for high availability along with the Auto Scaling group and scaling policy to improve resiliency.

  • You can set up a scaling policy based on Amazon CloudWatch metrics.

  • In AWS Elastic Beanstalk, you can configure the underlying Elastic Load Balancing settings and Amazon EC2 Auto Scaling.

Prerequisites and limitations


  • An active AWS account

  • An on-premises Java application running on GlassFish 

  • A Java Web Application Resource (WAR) file

Product versions

  • Oracle Glassfish 4.1.2 and 5.0

  • Java 7 GlassFish 4.0

  • Java 8 GlassFish 4.1 or later


Source technology stack

  • Applications developed in GlassFish

Target technology stack

  • Elastic Beanstalk

Target architecture

Migrate Java application on on-premises Oracle GlassFish server to Elastic Beanstalk in AWS Cloud.

Deployment workflow 

Deployment workflow to create app, upload and deploy new version, and update version.


  • Amazon Elastic Beanstalk – A service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on servers including Apache, NGINX, Passenger, and IIS.

  • Amazon CloudWatch – Provides data and actionable insights to monitor applications, responds to systemwide performance changes, optimizes resource utilization, and provides a unified view of operational health.

  • Docker – A platform that packages software into standardized units to build, test, and deploy applications quickly. 

  • Java – A general-purpose programming language. Java is class-based, object-oriented, and designed to have fewer implementation dependencies.


TaskDescriptionSkills required

Create a virtual private cloud (VPC) instance with the required information.


Create at least two subnets within the VPC.


Create a route table per requirements.

TaskDescriptionSkills required

Create an Amazon Simple Storage Service (Amazon S3) bucket.


Copy the WAR file to the S3 bucket and upload the application code.

TaskDescriptionSkills required

Create an AWS Identity and Access Management (IAM) role.

You can use the default "aws-elasticbeanstalk-ec2-role" profile, or let Elastic Beanstalk create it automatically.

TaskDescriptionSkills required

Open the Elastic Beanstalk dashboard.


Create a new application and choose the web server environment.


Choose GlassFish Docker as the preconfigured platform.


Upload the code.

Provide the S3 bucket file URL or ZIP file from local system files.


Choose the environment type.

In Configuration Capacity settings, choose either Single Instance or Load Balancer.


Configure Load Balancer.

If you chose Load Balancer in the previous step, configure the Multi-AZ deployment.


In Configuration Security settings, choose the previously created IAM role.


In Configuration Security settings, if you have an existing key pair, use it or create a new Amazon EC2 key pair.


In Configuration Monitoring settings, configure Amazon CloudWatch.


In Configuration Security settings, choose the previously created VPC.


Choose Create Environment.

TaskDescriptionSkills required

Test the application by using the URL provided in the created environment.

Apply the Domain Name Service (DNS) changes in Amazon Route 53.

Related resources