The article will review some of the high level steps I took to move my WordPress site from being hosted on Dreamhost over to AWS.
1. Create a Hosted Zone in AWS that matches your domain name
1.1 In the AWS console, navigate to Services > Route53 > Hosted Zones
Here you can see I have a few hosted zones, but for this article, we will be focusing on sethgagnon.com
1.2 Click Create Hosted Zone to create the new zone in AWS.
You will want to enter in the exact domain name that you are using today. Keep the defaults for the rest and click Create.
1.3 Confirm you now see your hosted zone in the list.
At this point, you are now ready to move on to updating your DNS records on your existing domain provider.
2. Create record sets in AWS on newly created Hosted Zone to match your existing DNS records.
2.1 Obtain your current DNS settings
You will need to login to your existing domain provider and review the DNS settings that are currently in place for your name. Here is a copy of what I observed in Dreamhost.
2.2 Select your Hosted Zone
You will now need to create these in AWS for the Hosted Zone you previously created. Click on the domain you created in the Hosted Zone list.
2.3 Then click on Create Record Set
2.4 Create Records Sets
Carefully go through the list you obtained from step 2.1 and ensure you create the EXACT same records in AWS. The only records you should omit for now are the Name Server (NS) records. Just leave those as is for now in AWS. You should have a list similar to the following (picture doesnt show all the records):
3. Update your DNS records on your existing domain vendor (Dreamhost in my case)
You may now update your domain registration with your existing provider to point to AWS Name Servers.
3.1 Obtain the AWS name servers from your hosted zone you previously created.
Search for the NS record type and obtain those values
3.2 Update your existing DNS settings
Login to your existing domain registration (Dreamhost for me) and point your name servers to the ones you obtained in step 3.1. Please note this could take up to 48 hours before your DNS settings are propagated. This all depends on your vendor. Please do not proceed to step 4 until you are sure that your DNS settings are using the AWS name servers.
4. Transfer your domain so that AWS has the registration
4.1 Obtain the Authorization code from your existing domain provider
You will need to enter an Authorization Code in AWS to initiate the domain transfer. I have masked some of this code out here.
4.2 Initiate Transfer to AWS
Go to Route53 in AWS console and click on Registered domains in the left menu. Then click on Transfer Domain.
4.3 Enter in the domain name you wish to transfer and click Check.
4.4 Click Add to Cart and then click Continue
4.5 Auth Code and name servers
Enter in your Auth code you obtained from step 4.1 and then select Import name servers from a Route53 hosted zone that has the same name as the domain. Ensure the hosted zone populates and it is correct. Then click Continue.
4.6 Contact Details for 1 Domain
Enter in your contact details as the domain owner.
4.7 Agree to terms and conditions and purchase
4.8 Validatation email
You will receive an email asking you to approve the transfer and validate your email address. After you have done so, the transfer process will begin.
5. Export existing WordPress site so it can be moved over
5.1 Select your plugin to use for migration
There are several good WordPress plugins available for migration of a site. I choose to use All-in-One WP Migration. If you don’t have it, install the plugin and then do an Export site. You can select where you would like to export the site to. I choose a file for now. Save the file somewhere safe, as we will need to use it for import later.
6. Create an EC2 instance that is running WordPress
6.1 Go back into the AWS console and navigate to EC2. Then click on Launch Instance
6.2 Choose your Amazon Machine Image (AMI)
In the left menu, select AWS Marketplace and then search for WordPress. Select the first option in the list and click Select
6.3 Click Continue after your review the pricing options (we will be using the AWS Free Tier option)
6.4 Choose Instance Type
Select the free tier eligible option here, unless you need to choose a different type for your needs. Click Next Configure Instance Details.
6.5 Configure Instance Details
You can keep the defaults here. I also enabled Cloudwatch for monitoring purposes, but you can always do that later if you so choose. Click Next: Add Storage
6.6 Add Storage
Enter the storage requirements you have. Pay attention to the free tier requirements. Click Next: Add Tags
6.7 Enter Tag (optional)
I like to use tags so that I can groups resources and easily find usage patterns. Then click on Next: Configure Security Group
6.8 Configure Security Group
This is an important step. This tells AWS how you want to communicate and open up your new server instance. Here, I am creating a new security group and I entered in a meaningful name and then I changed the SSH type to only allow my IP address (masked out) to SSH into this server. This is recommended. I will want to keep HTTP and HTTPS open as this will be how users access my WordPress blog. Click Review and Launch.
6.9 Review final details and Launch instance.
Click on Launch
6.10 Select Key Pairs
This is the security key that will be used to access this server instance you are creating. You can either create a new key pair, or use an existing one. Select Launch Instances
6.11 Launch Status
The instances are launching. Select View Instances at the bottom of the screen.
Ensure that your instance is launching and in running state.
6.13 Get the username and password to be able to login to your newly WordPress site.
The usage instructions tab outlines what you need to do to find the password for the user account to login to the site and manage WordPress.
7. Import your WordPress site
7.1 Login to your newly created WordPress site.
Look for the public DNS to use to access your WordPress instance. Use that in a browser and add /wp-admin to the end of the DNS. (Refer to those usage instructions from above on how to obtain the password for the default user account.)
7.2 Install the All-in-One WP Migration plugin and activate it.
7.3 Go to All-in-One WP Migration > Import
I am importing from a file. I selected the file and then waited for the upload to complete.
7.4 Look for successful import and follow any instructions.
8. Create an Elastic IP for your new EC2 instance
8.1 Navigate to AWS console EC2 > Elastic IPs and click on Allocate new address
8.2 Select allocate and then look for the new IP address
8.3 Select the Elastic IP address you just created
8.4 Then go to Actions > Associate address
8.5 Enter in the appropriate info from the drop down menus then click Associate
9. Update your hosted zone to point to the new Elastic IP address
9.1 In AWS console, navigate to Services > Route53 > Hosted Zone
9.2 Select the domain you wish to use to point to your newly created WordPress site and click on that domain name.
9.3 Click on Create Record Set and enter in the new Elastic IP Address as an A type record. Then click Create
If you already have an existing A record pointing to your older IP address from when it was with your previous domain, just edit existing record so that it now contains this new elastic IP address.