You can use an application load balancer to achieve it.
The load balancer works with target groups and you will need 2 target groups for your load balancer. First target group will map the https (443) to your jfrog docker and the second target group will map https (443) to your jfrog factory.
The target group for jfrog factory will look like:

The target group for jfrog docker will look like below.
P.S: My instance is unhealthy because it has nothing in it, just a dummy instance.

Important things in the target group is the port mapping of your application and the target type. Then register your EC2 instance with the target groups.
Now in your load balancer, choose the tab Listeners
and View/Edit rules
for the listener of type HTTPS (443).
Then add new rules using a condition host header
which will then redirect traffic to your target groups based on your subdomains (host header
), it should look something like below. P.S I do not have SSL certificates, so I have used http itself, https should not be any different.

The finally you must make a DNS entry of type CNAME to map your domain (xxx.io) to the load balancer's DNS name.
This is where you will get the load balancer's DNS name:
