2 простых шага к хостингу WordPress как к волшебству на AWS с помощью Amazon Lightsail

Amazon Lightsail — это самый простой способ помочь нам быстро начать работу с AWS для многих целей, таких как создание веб-сайта и многое другое. Существует множество услуг, которые можно запустить с помощью Lightsail очень быстро с низкой и предсказуемой ежемесячной ценой. Это может быть экземпляр (VPS), хранилище, контейнер, управляемая база данных и так далее. Более подробную информацию о Amazon Lightsail можно найти здесь!

Итак, здесь мы сделаем только 2 вещи:

1. Импортировать пару ключей
Обратите внимание, что пара ключей, определенная в Lightsail, отличается или не связана с другими сервисами AWS, такими как EC2 или IAM User (для 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
    }
}
Войдите в полноэкранный режим Выйти из полноэкранного режима

2. Создание экземпляра
Прежде чем создать экземпляр, необходимо определить некоторые параметры. Это BluePrint ID и Bundle ID. Если вы еще не знаете, вы можете получить список с помощью следующих команд:

  • Детали BluePrint ID для 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"
    }
]
Войти в полноэкранный режим Выйти из полноэкранного режима
  • Bundle ID для самого дешевого ($3,5 для 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"
    ]
}
Войти в полноэкранный режим Выйти из полноэкранного режима

Теперь давайте создадим экземпляр!

$ 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"
    ]
]
Войти в полноэкранный режим Выход из полноэкранного режима

Давайте проверим его, выполнив SSH, а затем получим доступ к нему через веб-браузер!

$ 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
Войти в полноэкранный режим Выход из полноэкранного режима

Поскольку у нас теперь есть пароль, а имя пользователя по умолчанию — user, заходим в приборную панель!

Настройки завершены! Если вы хотите удалить их, просто выполните команду delete delete-instance & delete-key-pair!

Вот и все! Спасибо, что пришли, и я с нетерпением жду ваших отзывов. Следите за мной, чтобы получать уведомления о публикации новых статей!

Оцените статью
devanswers.ru
Добавить комментарий