1

I'm trying to connect a subdomain to an AWS Elasticbeanstalk instance running a Django application using a certificate from AWS Certificate Manager. The domain is registered at 123-Reg.

AWS Certificate Manager is showing a validation status of success for the certificate.

I have added it to the Load balancers within the Elasticbeanstalk instance (Port 443, Protocal HTTPS, Instance Post 443, InstanceProtocol HTTPS, SSL Certificate as per Certificate Manager).

I have added the subdomain and the .acm-validations.aws to ALLOWED_HOSTS in the django app (I don't know if this is required).

Like this, the site gets directed to the VPS of the primary domain (rather than the subdomain). This simply causes an HTTPS error because there is no certificate for the subdomain on this VPS.

I've tried adding a CNAME DNS record for the subdomain to point at the url of the elasticbeanstalk instance, but this simply produces a blank screen.

How do I get a subdomain working with an elasticbeanstalk instance?

1 Answer 1

0

You need to setup a public zone with the same domain name in Route53 and then point the DNS for the zone to your DNS hosting provider instead of AWS. Also make sure that your public zone has the sub domain entry as well. In that entry you need to have an A record that points to your endpoint, which would be the Load Balancer.

As for the cert make sure your certificate covers both *.mydomain.com and mydomain.com. If you are using the AWS certificate manager you can add that by removing the current cert and re-adding it again with both names. Alternatively add a new certificate just with the subdomain.mydomain.com. I would go the *.mydomain.com route, that way any subdomain you add in the future to your publicly hosted zone will have a valid certificate.

6
  • Can you give me a little more information? Or point me at the relevant AWS documentation because I can set up a Hosted Zone and I can point the DNS to 123-Reg but nothing changes
    – HenryM
    Nov 7, 2019 at 21:02
  • Sorry looked like I must have omitted some info in the original reply. Also add a little more info in your question how everything is set up. There are so many variables and options in AWS.
    – Chupacabra
    Nov 7, 2019 at 21:41
  • How do I add an endpoint of the load balancer? What am I entering?
    – HenryM
    Nov 8, 2019 at 19:55
  • I don't think this is a full answer or I'm simply unable to follow because I cannot get this working. Remember, the domain name is hosted elsewhere and I need to setup AWS to access an elastic beanstalk / load balancer
    – HenryM
    Nov 11, 2019 at 16:35
  • @HenryM it doesn't matter where your domain is hosted. I have several Domain names that are hosted somewhere else, you need to point your domain at the AWS name servers. If you're not willing to let AWS host your DNS, then point the subdomain to the load balancer end point. In the AWS certificate manager or ACM you need to create a ssl certificate for your subdomain. This certificate will be used by the LB. docs.aws.amazon.com/acm/latest/userguide/…
    – Chupacabra
    Nov 12, 2019 at 19:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .