vivek bangare

Vivek Bangare

Author

How to Safely Update WordPress on AWS EC2

Hello everyone, In this article, I will talk about how to safely update WordPress on AWS EC2 instances. In the next few minutes, we will understand creating AMI, take backup and restore the database. At the end of this article will be able to understand the safe updation process of production instances. 

Assumption:
  • You have a separate web instance (EC2) and DB instance (RDS) for your WordPress site.
  • DB is of MySQL is configured in AWS RDS
  • Credentials for MySQL 
Prepare Before Upgrading WordPress

Firstly create one AMI for the current web instance(EC2), please follow the below steps. We will perform this through the AWS console.

  • Login to the AWS console
  • Select the EC2 instance(WordPress web instance) from the EC2 section.
  • Create one AMI from the current WordPress instance.

Action ⇒ Image and templates ⇒ Create image

select-ec2-for-ami

Fill in the details for AMI and click on the ‘Create image’ button.

Note: Please make sure to enable No reboot, otherwise your instance will reboot.
create-ami-from-ec2

It may take a couple of minutes for the AMI to be created. After its creation, it will appear in the AMIs view in AWS Explorer.

Secondly, we have to take a backup of MySQL DB.

Follow the below command for taking backup(as a dump) of the MySQL database through the mysqldump utility.

mysqldump -u {username} -p'{password}' -h {hostname} -P {port} {db_name} > {wordpress}.sql

For restoring DB you can use the below command.

mysql -u {username} -p'{password}' -h {hostname} -P {port} {db_name} < {wordpress}.sql
Note: you can use any name for .sql file.
Backup and Restore steps are optional, but for safer side we should always take backup of any database before any activity.
Updating WordPress via the Admin Dashboard

This method is easier and is recommended for all users.

Thirdly and most importantly, log in to the admin area of your WordPress website. 

wordpress-login

Go to Dashboard » Updates page.

Note: While writing this article 5.7.1 is latest available update for worpress, in your case it might be diffrent.

Now you can see in the top most section that a new version of WordPress is available. You just need to press the ‘Please update now’ button, then ‘Update Now’ to initiate the update.

WordPress will now fetch the latest version of the software and install it for you.

See the update progress process on your screen. During the upgrade, WordPress will put your site in maintenance mode.

At this stage, your site will be visible to users, but will not be able to install any plugins or themes.

After successful installation, you will be redirected to the WordPress welcome screen. Depending on each release you may see a page explaining what’s new in WordPress and the new features which you should try.

That’s all, Now we have successfully updated WordPress to the latest version.

For better security, we need to update the PHP version also which is compatible with our WordPress.

Leave a Comment

Your email address will not be published.