Configure a WordPress Instance with Amazon Lightsail
Tags: webdev, aws, cloud, wordpress
Published: 2023-05-26 12:51:29

Sometimes you just want to get up and running without the hassle involved with configurations and the likes. With Amazon Lightsail you can do this and more. Lightsail provides developers compute, storage, and networking capacity and capabilities to deploy and manage websites and web applications in the cloud. 

Lightsail includes everything you need to launch your project quickly – virtual machines, containers, databases, CDN, load balancers, DNS management etc. This is especially good if you just need to get started quickly and have  a good jump off point seeing as Amazon Lightsail is the easiest way to get started with Amazon Web Services (AWS) if you just need virtual private servers. Lightsail includes everything you need to launch your project quickly. You can [read more about lightsail.](https://aws.amazon.com/lightsail/)

## WordPress?
WordPress is an open-source content management system (CMS). It's a popular tool for individuals without any coding experience who want to build websites and blogs. The software doesn't cost anything. Anyone can install, use, and modify it for free. [More on wordpress.](https://wordpress.com/)
&nbsp;
Enough talk let’s get into deploying wordpress on lightsail. 
&nbsp;
Before we proceed, here are basic assumptions i have: 
1. You have a working AWS Account.
2. You have registered a domain name with AWS Route 53 or any domain registrar. 

### Step 1: Sign into the AWS console, search for lightsail and click to navigate to the lightsail dashboard.


![AWS Console search for lightsail](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wptraru7cfq0fbbe6vcn.png)

![Lightsail Dashboard Welcome](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rkr2f1gf1qlpa1bd7v90.png)


### Step 2: Creating the Wordpress Lightsail Instance

a. On the Instances tab of the Lightsail home page, choose Create instance.

b. An AWS Region and Availability Zone is selected for you but you can  choose or change AWS Region and Availability Zone if you want to create your instance in a different  location.

![Create Instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4ok7719p4tnftraxkfd.png)

c. Choose your instance image.
- Choose Linux/Unix as the platform.
- Choose WordPress as the blueprint.

![Choose platform and blueprint](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7m920w734n6kail48qlm.png)

d. Choose an instance plan. I went with the smallest for this demonstration but lightsail is free for the first 3 months so no cost was incurred. 

![Select plan](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nqm593yb7r5u2bcn500k.png)

e. Enter a name for your instance and choose Create instance.

![Create instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1csyrw31dxndro51g1j8.png)


### Step 3: Connect to your instance via SSH and get the password for your WordPress website

The default password to sign in to the administration dashboard of your WordPress website is stored on the instance. So we have to ssh into it and retrieve the password. 

a. On the Instances tab of the Lightsail home page, choose the SSH quick-connect icon for your WordPress instance.

![SSH link to instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ykodhyz3pcbqdy3mzh55.png)

b. After the browser-based SSH client window opens, paste the following command to get the admin password. 
```
cat $HOME/bitnami_application_password
```

c. Copy the password out to a text document or somewhere as you would use it to sign in. 

![Terminal output of password](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vjkmg2dl5drfvtizhvx.png)

### Step 4: Sign in to the administration dashboard of your WordPress website.

a. In a web browser window go to 
```
http://PublicIpAddress/wp-login.php
```
Note you need to replace PublicIpAddress with the public IP address of your WordPress instance. You can get your instance's `public IP address` from the Lightsail console as shown in the image below.

![IP Address of instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qo6piswc160kqdlab2gi.png)

b. Log in to your instance. 
- In the Username or Email Address box, enter user.
- In the Password box, enter the default password obtained earlier in from the SSH login.
- Choose Log in. 

![Wordpress login](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v5us51t0g10k7vqk7325.png)

c. You should be signed in now. 

![Wordpress dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qca9oye6mkacjsayy3vx.png)

### Step 5: Create a Lightsail static IP address and attach it to your WordPress instance

The default IP always changes when you stop and start your instance to fix that we would create and attach a static IP to our lightsail instance to prevent this from happening. 

a. On the Instances tab of the Lightsail home page, choose your running WordPress instance.

![Select instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mrdjqsj1fow1nuopra64.png)

b. Choose the Networking tab, then choose Create static IP.

![Select static IP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dghqzx9vegtpjh42eagh.png)

c. The static IP location is preselected based on the instance zone that you chose earlier. Select the created WordPress instance from the Attach to an instance dropdown.

![Select instance for static ip](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j8eiujnvxus0go6dagqb.png)

d. Name your static IP, then choose Create. 

![Name and create static ip](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvr517humktnyq4ldzvs.png)

You can now navigate to your wordpress instance using the new static IP, you can also stop and start your instance to test out the static IP. 

### Step 6: Create a Lightsail DNS zone and map a domain to your WordPress instance

We don’t really want our wordpress website visitors memorising a series of numbers or IP addresses right. This is where the DNS zone mapping comes in. 

a. On the Domain and DNS tab of the Lightsail home page, choose Create DNS zone. 

![Create DNS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8y0ivszrq05j92c7y0bo.png)

b. Enter your domain, then choose Create DNS zone. 

![Enter domain name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zxkhjdaw8epauq3521mb.png)

*Note: Make sure you have the domain registered already on AWS or any domain registrar.* 

c. Make note of the name server address listed on the page. 

![Nameservers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x26ygxtf6tinw9ksml1g.png)

You add these name server addresses to your domain name’s registrar to transfer management of your domain’s DNS records to Lightsail. If you don’t know how to do this, [i have a guide on this here](https://dev.to/1zyik/how-to-connect-your-namecheap-domain-to-route-53-2i8)

d. Next we create an A record, In the DNS zone for your domain, choose Add record.

![Create a record](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8b623uy67f28nthtz8a0.png)

e. In the Subdomain box, enter an @ symbol to map the apex of your domain (such as example.com) to your instance. The @ symbol explicitly symbolises that you’re adding an apex record. It is not added as a subdomain.

In the Resolves to box, choose the static IP that you attached to the WordPress instance in the previous step of this tutorial.

Choose the green save icon.

![Create record complete](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uft3wnn2lhs2r57rozgd.png)


Allow time for the change to propagate through the internet's DNS before your domain begins routing traffic to your WordPress instance. 

You should be able to visit your lightsail wordpress instance  now using the your domain name. 

### Step 7: Clean up

- On the Instances tab of the Lightsail home page, choose the ellipsis (⋮) icon next to the WordPress instance you just created and choose Delete.
- Choose Yes, delete from the prompt.


![Delete instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ggkkfyssf2g5tej8s1k1.png)

- You should also navigate to the static IP section and delete the IP as well. 

And that is how you configure wordpress on Amazon Lightsail, pretty easy right. I’ll see you around ✌️



Credits: *Amazons guide to [configuring wordpress on Lightsail.](https://aws.amazon.com/getting-started/hands-on/launch-a-wordpress-website/?ref=gsrchandson)*