How to run WildFly on AWS EC2

In this tutorial I’ll show you how you can install Wildfly application server on Amazon EC2 instance.

The pre-requesite is that you have already your Amazon account available, so you are ready to launch a new Instance:

Wildfly application server on Amazon EC2 instance

In the next Window, choose one of the available Images, for example a RHEL 8:

Wildfly application server on Amazon EC2 instance

You will have to choose the Instance type, which will eventually determine the charge for the service:

Wildfly application server on Amazon EC2 instance

In order to be able to connect to your instance with SSH, you will need to download a Key Pair:

Wildfly application server on Amazon EC2 instance

Download the key and start the Instance. Then fix the permission for the key:

$ chmod 400 /home/user/.ssh/fmarchio-key.pem 

Now you can connect to the public address of your instance with SSH using the key;

ssh -i [your-instance-key-pair].pem ec2-user@hostname

As new step, we will install OpenJDK on the machine as follows:

$ sudo yum install java-1.8.0-openjdk-devel

Now, move to the /opt directory and download and extract Wildfly distribution using following commands:

$ cd /opt
$ sudo wget https://download.jboss.org/wildfly/18.0.0.Final/wildfly-18.0.0.Final.zip 
$ unzip wildfly-18.0.0.Final.zip 

The application server is ready to be started, however in order to run it as a service we will perform some additional steps as discussed here: How to run WildFly as Service

Finally, when you are done and the application server is started, you can access it via browser at: your-ec2-public-address:8080

Found the article helpful? if so please follow us on Socials