In my previous post I had written on how to convert AWS EC2 On Demand (OD) instance to Reserve Instance (RI) for running dedicated and heavy traffic based website like blog or any ecommerce website which require high configuration, but if your website does not have much traffic or you do not want high compute and storage configuration then using AWS OD or RI instance will not be benefited you. In such case instead of using AWS OD or RI instance for hosting your small website like WordPress blog you can choose Amazon Lightsail as it is an ideal for basic resource usage instance in terms of low cost.
I got an opportunity to get my hands dirty by using Amazon LightSail instance for running and migrating my this WordPress blog from my old AWS EC2 t2.micro instance. The big reason for making plans for migrating my old WordPress blog to this new WordPress blog hosted on Amazon Lightsail instance is cost factor and old AWS EC2 instance Linux OS Ubuntu 14 and WordPress version 5 were also became obsolete.
The Amazon Lightsail instance which I am using for hosting this new WordPress blog has basic configuration such as 512 MB RAM, 20 GB of SSD, 1 vCPU and Linux OS is Debian 11 this instance is costing me $3.50 per month which is much cheaper if I compared with my earlier WordPress blog which had same configuration hosted on AWS EC2 t2.micro instance, only instance price was $0.0052 per hour or approx. $3.38 per month excluding SSD and data transfer cost. If you go with a similar SSD, data transfer rate and other configuration with AWS t2.micro instance it would cost you approx. $5 to $6 per month.
In a nutshell If I define the Amazon Lightsail, it is a Virtual Private Server or VPS which is packaged with compute, storage, networking and DNS. It also allows you to create additional storage (disk or S3 bucket), database, containers, static IP, CDNs, Snapshots etc.
In this blog I will only explain how I provisioned my new Amazon Lightsail instance and migrated my old WordPress blog to this new WordPress blog.
Provisioning of Amazon Lightsail instance
- Access Amazon Lightsail by accessing below link:
- Under Instances tab click on Create Instance button
- Under Instance location page select AWS Region and Availability Zone (AZ) or keep it default if you are fine with existing Region and AZ
- Select OS Platform in my case I had chosen Linux/Unix
- Under Select a Blueprint choose Apps+OS and select WordPress
- Choose your desired instance plan as per your requirement. As I only wanted to host WordPress blog, so I had chosen cheaper one which is $3.5 plan with basic configuration
- Provide your Amazon Lightsail instance desired name and then click on “Create instance” button
- In few minutes your Amazon Lightsail instance will be ready and will be visible under instances tab. Now to access its console you need to click on the small command terminal icon which would be visible on left side of running instance.
- After clicking on the command terminal icon, you will be presented with your lightsail console screen.
- For security reasons I applied the latest patches and rebooted it. This below step is not mandatory, but it is recommended that whenever you provision your new instance always apply latest security patches, even periodically as well.
Creating and attaching static IP with Lightsail instance
For migrating and hosting new WordPress blog it is necessary to create static IP so that later it can be updated with existing DNS record. In my case I released my previous EC2 t2.micro Elastic IP for saving cost and updated it in AWS Route 53 DNS record with lightsail static IP as Amazon Lightsail provide 5 free static IP addresses but you need to be cautious during the migration that do not release the Elastic IP till then you migrate your existing WordPress blog to newly provisioned WordPress Lightsail instance otherwise it will be difficult to access the existing WordPress admin console.
In below steps I will guide you how I created and attached static IP with my new WordPress Lightsail instance and in later section I will guide you how I updated this newly created static IP with exiting DNS record:
- Access the Lightsail below link:
- Click on the Networking tab and click on “Create Static IP” button.
- Under Create and attach a static IP provide desired name for identifying static IP resource.
- Once the name is provided click on “Create and attach” button for attaching the static IP resource with Amazon Lightsail instance. You will be presented with a confirmation message.
- Now under Networking you can see the static IP which is associated or attached with your new WordPress Lightsail instance
Updating Static IP with existing WordPress site AWS Route 53 DNS record
In this section I will guide you how I updated newly created Static IP (procedure mentioned in previous section) with existing AWS Route 53 DNS record:
- Access the AWS Route 53 page by clicking below link:
- Click on Hosted Zone under DNS Management.
- Under the Hosted Zone click on your registered domain name.
- Select “A” record in front of your domain name and under Record details click on edit record button which is visible in left side bar.
- At left side bar you will get option for updating the Static IP address or A record under value box so update the newly created Static IP there and click on Save button.
- Once done give some time to AWS Route 53 for repointing your existing domain to updated new Static IP in its DNS record and Global DNS record as well.
Migration of existing WordPress to newly provisioned WordPress Lightsail instance
- Access your existing WordPress admin console with below IP address:
Note: Replace the <publicIP> with your existing AWS EC2 instance Elastic IP address or Public IP Address.
- Click on Tools > Export
- Under “Choose what to export” select All content and then click on button “Download Export File “. This will export all your existing WordPress blog content in xml backup file in your local system.
- Now access your newly provisioned WordPress Lightsail admin console with the same method by providing its StaticIP.
- Provide the login username as “user” for login to new WordPress admin console. To get the default user password you need to connect with newly provisioned lightsail instance console
- Run the below command in your lightsail instance console for getting the default user id password.
- Once you login with default user name and password in new WordPress admin console, go to Tools>Import and then under Import install the WordPress as this import tool which will help us in importing existing WordPress blog content.
- Once import tool installed successfully click on Run importer for importing the content
- Next page will allow you with option to browse the downloaded exported xml file based content and then Click on button “Upload file and import”.
- Once content is uploaded and imported it will present the screen with the list of your imported contents with All done message.
Voilà! Your existing WordPress Blog content is successfully migrated to newly provisioned WordPress lightsail instance and ready to serve. You can now access your newly provisioned Amazon Lightsail instance with your existing domain name.