I need to link example.com to two AWS Wordpress instances. example.com has an A-record pointing the ELB URL. As mentioned here, I added


and in theme's functions.php

update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );

Also added define('RELOCATE',true); in wp-config.php. Before adding these, Wordpress works by hitting the public IPs, but after adding these, I simply receive 503 error from example.com, and if I try the public IPs, they're simply redirected to example.com, thus giving 503 again.

Another thing to note is that if I replace example.com with the respective EC2 IPs in the above configuration files, the site works, but relative URLs have a bad format like www.example.com/<ip-address>/contact-us#

I am probably following a wrong approach to deal with Auto-scaling and ELB.


This really isn't a Wordpress question per say. You need to create an ELB (Elastic Load Balancer) which then generates a DUAL-STACK CNAME which you can then use as an alias for your domain name in Route53. You do NOT want to simply use an A record for the ELB as Amazon has the right to change those IPs anytime they want.

Once you have your ELB setup and your example.com pointing to it, you then can attach your two EC2 instances to them.

You do not need to change anything special in your wp-config.

You WILL have to be mindful of your wp-admin and content that you are uploading, as if you upload an image through the media library it will only be on 1 ec2 instance and not the other. This is where offloading your media library to S3 and CloudFront come into play.

Finally you WILL also need to be mindful of updating plugins as the same issue that arrises with uploading media will happen when updating plugin files. There are a several ways to work through this, but two common ones would be to have a proxy server setup which you make the updates to, then take an image of that server and put that into your Launch Policy for autoscaling so when new servers are created they use the new updated image. Another option would be to look into Amazons Elastic File System.

So long story short, really a AWS question and not a wordpress question. I would take a look at https://cloudonaut.io/wordpress-on-aws-you-are-holding-it-wrong/ and possibly https://serifandsemaphore.io/how-to-host-wordpress-like-a-boss-b5993fcfbd8e#.m92j2kdqu

Hope that helps.

  • Thanks for the update. To be clear, while I have mentioned ELB/Auto scaling, that's just a step in my required process. The main issue is that even without ELB/Auto scaling, if I am trying to link example.com to the IP address of a single instance, I am getting 503 error. – Utkarsh Mishra Feb 23 '17 at 21:57
  • Again, it still sounds like a server config issue rather than a wordpress issue. Start doing some simple debugging. If you go to your instance directly via - ec2-XX-XXX-XXX-XXX.compute-1.amazonaws.com does the site load up? If not, create a simple hello.txt file and then try to access ec2-XX-XXX-XXX-XXX.compute-1.amazonaws.com/hello.txt does that load up? If so than try a simple hello.php with <?php echo 'Hello'; ?> in it. See if that loads up. Keep going down the line. – Matt Pramschufer Feb 24 '17 at 14:41
  • Already tried it. Anyway, also posted this question here – Utkarsh Mishra Feb 24 '17 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.