2 Easy Steps to Host WordPress Like a Magic Using Amazon Lightsail

nurulramadhona

Nurul Ramadhona

Posted on July 20, 2022

2 Easy Steps to Host WordPress Like a Magic Using Amazon Lightsail

Amazon Lightsail is the easiest way to help us get started with AWS very quickly for many purposes such as building websites and many more. There are a lot of services that can be launched with Lightsail very quickly with low and predictable monthly prices. It can be an instance (VPS), storage, container, managed database, and so on. For more information about Amazon Lightsail, click here!

Lightsail WordPress

Alright, here we will only do 2 things:

1. Import Key Pair

Please note that the key pair defined in Lightsail is different or not associated with other AWS services like EC2 or IAM User (for CodeCommit).

$ aws lightsail import-key-pair --key-pair-name bitnami --public-key-base64 "ssh-rsa pubkey-goes-here" --region ap-southeast-1
{
    "operation": {
        "id": "4568c408-0349-4788-a922-e9fa6c3591a7",
        "resourceName": "bitnami",
        "resourceType": "KeyPair",
        "createdAt": 1653553305.861,
        "location": {
            "availabilityZone": "all",
            "regionName": "ap-southeast-1"
        },
        "isTerminal": true,
        "operationType": "ImportKeyPair",
        "status": "Succeeded",
        "statusChangedAt": 1653553306.012
    }
}
Enter fullscreen mode Exit fullscreen mode

2. Create Instance

Before we create an instance, there are some parameters that we need to define. Those are BluePrint ID and Bundle ID. If you still don't know, you can get the list with the following commands:

  • BluePrint ID details for WordPress:
$ aws lightsail get-blueprints --region ap-southeast-1 --query 'blueprints[?contains(blueprintId, `wordpress`) == `true`]'
[
    {
        "blueprintId": "wordpress",
        "name": "WordPress",
        "group": "wordpress",
        "type": "app",
        "description": "Bitnami, the leaders in application packaging, and Automattic, the experts behind WordPress, have teamed up to offer this official WordPress image. This image is a pre-configured, ready-to-run image for running WordPress on Amazon Lightsail. WordPress is the world's most popular content management platform. Whether it's for an enterprise or small business website, or a personal or corporate blog, content authors can easily create content using its new Gutenberg editor, and developers can extend the base platform with additional features. Popular plugins like Jetpack, Akismet, All in One SEO Pack, WP Mail, Google Analytics for WordPress, and Amazon Polly are all pre-installed in this image. Let's Encrypt SSL certificates are supported through an auto-configuration script.",
        "isActive": true,
        "minPower": 0,
        "version": "5.9.3-8",
        "versionCode": "1",
        "productUrl": "https://aws.amazon.com/marketplace/pp/B00NN8Y43U",
        "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/7d426cb7-9522-4dd7-a56b-55dd8cc1c8d0/588fd495-6492-4610-b3e8-d15ce864454c.txt",
        "platform": "LINUX_UNIX"
    },
    {
        "blueprintId": "wordpress_multisite",
        "name": "WordPress Multisite",
        "group": "wordpress_multisite",
        "type": "app",
        "description": "WordPress Multisite is ideal for organizations such as universities, corporations, and agencies that need to enable many people to host and manage their own websites while giving overall control to a central administrator. These websites can all have unique domain names and layouts while sharing assets such as themes and plugins. Popular plugins like Jetpack, Akismet, All in One SEO Pack, WP Mail, Google Analytics for WordPress, and Amazon Polly are all pre-installed in this image. Let's Encrypt SSL certificates are supported through an auto-configuration script. This image is certified by Bitnami as secure, up-to-date, and packaged using industry best practices.",
        "isActive": true,
        "minPower": 0,
        "version": "5.9.3-8",
        "versionCode": "1",
        "productUrl": "https://aws.amazon.com/marketplace/pp/B00NN8XE6S",
        "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/2f1d4d67-324b-41d7-8af9-b7860d269c6d/6338ef47-28a8-482d-b57a-4859280a021e.txt",
        "platform": "LINUX_UNIX"
    }
]
Enter fullscreen mode Exit fullscreen mode
  • Bundle ID for the cheapest one ($3.5 for nano 2.0):
$ aws lightsail get-bundles --query 'bundles[0]' --region ap-southeast-1
{
    "price": 3.5,
    "cpuCount": 1,
    "diskSizeInGb": 20,
    "bundleId": "nano_2_0",
    "instanceType": "nano",
    "isActive": true,
    "name": "Nano",
    "power": 300,
    "ramSizeInGb": 0.5,
    "transferPerMonthInGb": 1024,
    "supportedPlatforms": [
        "LINUX_UNIX"
    ]
}
Enter fullscreen mode Exit fullscreen mode

Now, let's create the instance!

$ aws lightsail create-instances --instance-names wp-instance --availability-zone ap-southeast-1a --blueprint-id wordpress --bundle-id nano_2_0 --key-pair-name bitnami --region ap-southeast-1
{
    "operations": [
        {
            "id": "b4324f47-a520-4424-b99c-ad026c50546b",
            "resourceName": "wp-instance",
            "resourceType": "Instance",
            "createdAt": 1653555007.628,
            "location": {
                "availabilityZone": "ap-southeast-1a",
                "regionName": "ap-southeast-1"
            },
            "isTerminal": false,
            "operationType": "CreateInstance",
            "status": "Started",
            "statusChangedAt": 1653555007.628
        }
    ]
}
$ aws lightsail get-instances --region ap-southeast-1 --query 'instances[].[name, location, blueprintId, bundleId, privateIpAddress, publicIpAddress]'
[
    [
        "wp-instance",
        {
            "availabilityZone": "ap-southeast-1a",
            "regionName": "ap-southeast-1"
        },
        "wordpress",
        "nano_2_0",
        "172.26.13.11",
        "18.141.24.138"
    ]
]
Enter fullscreen mode Exit fullscreen mode

Let's access it through SSH and web browser!

$ ssh bitnami@18.141.24.138
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
       ___ _ _                   _
      | _ |_) |_ _ _  __ _ _ __ (_)
      | _ \ |  _| ' \/ _` | '  \| |
      |___/_|\__|_|_|\__,_|_|_|_|_|

  *** Welcome to the WordPress packaged by Bitnami 5.9.3-8         ***
  *** Documentation:  https://docs.bitnami.com/aws/apps/wordpress/ ***
  ***                 https://docs.bitnami.com/aws/                ***
  *** Bitnami Forums: https://community.bitnami.com/               ***
bitnami@ip-172-26-13-11:~$ cat bitnami_application_password 
KPInbPj1giRB
Enter fullscreen mode Exit fullscreen mode

Because we have the password now and the default username is user, let's go through dashboard!

WordPress

WordPress Login

WordPress Dashboard

It's a wrap! In case you want to delete them, just run delete command delete-instance & delete-key-pair!

That's it! Thank you for coming and I'm looking forward to your feedback. Follow me to get notified when my new post is published!

💖 💪 🙅 🚩
nurulramadhona
Nurul Ramadhona

Posted on July 20, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related