How to deploy advanced yii2 project in an autoscaling group on aws

I am trying to deploy my application on aws. I used an ec2 instance and configure it with two virtual hosts and used the IP address to create an (A) record for each vhost (, and everything was working fine.

The second step was to deploy this app in an auto scaling group. I created an application load balancer and assigned a target group. the instances under this target group are healthy and the load balancer is working. but when I create the (CNAMEs) with the subdomains for the elb DNS, it does not work. How can I troubleshoot and solve this problem?

This sounds more like a infrastructure or aws related question perhaps ask in aws forums