This tutorial describes how to use StackMover Lite wordpress plugin to clone a live wordpress onto a new Amazon LightSail instance. In order to use the plugin, you would need to be able to create an IAM user with privileges to read/write to an Amazon S3 bucket and launch Amazon LightSail instances.

Step 1: Create IAM User

Stackmover uses an IAM user to securely control access to specific S3 bucket and create LightSail instances. The process to create this user has been automated for ease of use via AWS CloudFormation. To create the IAM user, simply launch AWS CloudFormation template as below.


image test
Step 1a. Create AWS Keys


image test
Step 1b. Click Next on CloudFormation Console


The CloudFormation template could be used to either create a new S3 bucket or use an exiting bucket. An IAM user is created inside the template with minimal set of specific privileges needed during migration. The specific set of privileges assigned to the IAM user is as below.


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
  "Policies":[
    {
      "PolicyName":"WP2LightSailMigratorS3Access",
      "PolicyDocument":{
        "Version":"2012-10-17",
        "Statement":[
          {
            "Effect":"Allow",
            "Action":[
              "s3:AbortMultipartUpload",
              "s3:CreateBucket",
              "s3:Get*",
              "s3:List*",
              "s3:PutObject",
              "s3:PutObjectAcl"
            ],
            "Resource":[
              {
                "Fn::Join":[
                  "",
                  [
                    "arn:aws:s3:::",
                    {
                      "Ref":"S3BucketName"
                    },
                    "/*"
                  ]
                ]
              },
              {
                "Fn::Join":[
                  "",
                  [
                    "arn:aws:s3:::",
                    {
                      "Ref":"S3BucketName"
                    }
                  ]
                ]
              }
            ]
          }
        ]
      }
    },
    {
      "PolicyName":"WP2LightSailMigratorS3DeleteBackup",
      "PolicyDocument":{
        "Version":"2012-10-17",
        "Statement":[
          {
            "Effect":"Allow",
            "Action":[
              "s3:DeleteObject"
            ],
            "Resource":[
              {
                "Fn::Join":[
                  "",
                  [
                    "arn:aws:s3:::",
                    {
                      "Ref":"S3BucketName"
                    },
                    "/wp-to-cloud*"
                  ]
                ]
              }
            ]
          }
        ]
      }
    },
    {
      "PolicyName":"WP2LightSailMigratorEc2Describe",
      "PolicyDocument":{
        "Version":"2012-10-17",
        "Statement":[
          {
            "Sid":"Stmt1504923428001",
            "Effect":"Allow",
            "Action":[
              "ec2:DescribeAvailabilityZones"
            ],
            "Resource":[
              "*"
            ]
          }
        ]
      }
    },
    {
      "PolicyName":"WP2LightSailMigratorLightsail",
      "PolicyDocument":{
        "Version":"2012-10-17",
        "Statement":[
          {
            "Sid":"Stmt1504923428000",
            "Effect":"Allow",
            "Action":[
              "lightsail:*"
            ],
            "Resource":[
              "*"
            ]
          }
        ]
      }
    }
  ]
}

In the example below, an existing S3 bucket stackmover-demo is being used.

image test
Step 1c. Click Next

image test
Step 1d. Click Next


image test
Step 1e. Acknowledge IAM role creation


Once CloudFormation stack is complete successfully, secure the AWS Access Key and Secret Key securely (found in Output tab).

image test
Step 1f. Securely store IAM keys


Step 2: Verify IAM Keys

In the StackMover plugin page, enter the AWS Access Key and Secret Key and verify the validity of the keys. Validation process ensures S3 bucket is accessible via plugin.


image test
Step 2a. Validate AWS Keys

Step 3: Add Migrator Options

Modify default transfer option as needed. Plugin will transfer all themes, plugins and database dump created via mysqldump onto a new LightSail instance. A search and replace operation in the database is also available as an option.



The database string replacer works on the destination database only and hence the source database remains unchanged. Currently, if you specify EIP in the replace-with string, it will be replaced with the Elastic IP of the LightSail instance. For example, when a dev system running wordpress on http://localhost:8888/wordpress is migrated to a LightSail instance, you may choose the replacer to be http://EIP and the new elastic IP will be used by replacer in the place of EIP.


image test
Step 3a. Transfer Option
image test
Step 3b. Search Replace DB Option

Step 4: Single Click Migration!

With all the option in place, we are ready to migrate a live instance onto a new LightSail. This process will create a compressed file bundle in the chosen S3 bucket with all the necessary files needed to clone the source wordpress. A new LightSail instance running ubuntu OS is launched and a LEMP stack (Linux + Nginx + Php + Mysql) is setup at run time. Files are moved from the destination S3 bucket onto the LightSail instance and database imported. The resulting public IP should be running the cloned wordpress.



image test
Step 4a. Click for single click migration


image test
Step 4b. New LightSail launched!

Leave Comments below