{"id":6590,"date":"2022-11-26T17:54:01","date_gmt":"2022-11-26T08:54:01","guid":{"rendered":"https:\/\/the-world-star.com\/?p=6590"},"modified":"2026-11-17T21:35:46","modified_gmt":"2026-11-17T12:35:46","slug":"migrating-a-web-server-from-aws-ec2-to-amazon-lightsail","status":"publish","type":"post","link":"https:\/\/the-world-star.com\/en\/server\/migrating-a-web-server-from-aws-ec2-to-amazon-lightsail-6590\/","title":{"rendered":"Migrating a Web Server from AWS EC2 to Amazon Lightsail"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This article is a log of my journey migrating my web server from EC2 to Amazon Lightsail.<br>Also, this is just a test post before the actual migration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My AWS free tier is ending in just a few days. EC2 is a bit too pricey for a basic web server, so I was considering downgrading to a t2.nano. However, for a personal blog with minimal traffic, Amazon Lightsail seems like a much better fit. The cheapest option is $3.50\/month\u2014though with the super weak yen right now, that comes out to about 486 yen. Still, super cheap. Plus, if you choose the WordPress pre-configured image, it allegedly comes with everything you need. It looks like a standard managed web server rental, but you also get SSH access so you can do pretty much whatever you want, just like before. You can even run a Minecraft server on it (though you might need the $5 plan for that).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I bounced around looking at various senior blogs for guidance, but this site was fantastic\u2014up-to-date, straightforward, and didn't leave anything out.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/specially198.com\/migrate-wordpress-to-lightsail-on-aws\/\">https:\/\/specially198.com\/migrate-wordpress-to-lightsail-on-aws\/<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating and Setting Up the New Server on Lightsail<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">So, let's get to work.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a Lightsail Instance<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Log into AWS and head over to Lightsail.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"584\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204341\/Screenshot-from-2022-11-26-09-03-37-1024x584.png\" alt=\"\" class=\"wp-image-4023\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204341\/Screenshot-from-2022-11-26-09-03-37-1024x584.png 1024w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204341\/Screenshot-from-2022-11-26-09-03-37-300x171.png 300w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204341\/Screenshot-from-2022-11-26-09-03-37-768x438.png 768w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204341\/Screenshot-from-2022-11-26-09-03-37-1536x876.png 1536w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204341\/Screenshot-from-2022-11-26-09-03-37.png 1846w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For some reason, the vibe here is totally different\u2014much more pop-oriented. Was this built by a different team?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"584\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204423\/Screenshot-from-2022-11-26-09-03-55-1024x584.png\" alt=\"\" class=\"wp-image-4024\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204423\/Screenshot-from-2022-11-26-09-03-55-1024x584.png 1024w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204423\/Screenshot-from-2022-11-26-09-03-55-300x171.png 300w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204423\/Screenshot-from-2022-11-26-09-03-55-768x438.png 768w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204423\/Screenshot-from-2022-11-26-09-03-55-1536x876.png 1536w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204423\/Screenshot-from-2022-11-26-09-03-55.png 1846w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Create an instance by selecting Apps + OS and choosing WordPress (Linux\/Unix -> WordPress). There seem to be several other similar web server options as well. Give it an appropriate, easy-to-understand name...<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"584\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204450\/Screenshot-from-2022-11-26-09-17-32-1024x584.png\" alt=\"\" class=\"wp-image-4025\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204450\/Screenshot-from-2022-11-26-09-17-32-1024x584.png 1024w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204450\/Screenshot-from-2022-11-26-09-17-32-300x171.png 300w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204450\/Screenshot-from-2022-11-26-09-17-32-768x438.png 768w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204450\/Screenshot-from-2022-11-26-09-17-32-1536x876.png 1536w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204450\/Screenshot-from-2022-11-26-09-17-32.png 1846w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br>And just like that, a public WordPress server is ready to go.<br>No need for Apache2, PHP, or configuration editors. You don't even have to configure WordPress at all. Right now, the IP is still randomly assigned on startup.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Assigning a Static IP<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Attaching a static IP is... seriously just about two clicks. Incredibly easy. It was so simple I didn't even bother taking screenshots.<br>Go to the Lightsail tab, click \"Networking\" -> \"Create static IP\", and bind it to the Lightsail instance you just created. Just like EC2, be careful\u2014if you leave it unassigned, you'll get hit with penalty-like charges. If you stop using it, delete it immediately.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">SSH<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can SSH right from your browser.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"482\" height=\"156\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204657\/Screenshot-from-2022-11-26-17-00-59.png\" alt=\"\" class=\"wp-image-4026\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204657\/Screenshot-from-2022-11-26-17-00-59.png 482w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204657\/Screenshot-from-2022-11-26-17-00-59-300x97.png 300w\" sizes=\"auto, (max-width: 482px) 100vw, 482px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">It's in a much more intuitive and simpler spot than EC2. On this business-card-looking dashboard, you just click the orange terminal-like icon in the top right to jump in.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"890\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204908\/Screenshot-from-2022-11-26-09-13-45-1024x890.png\" alt=\"\" class=\"wp-image-4028\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204908\/Screenshot-from-2022-11-26-09-13-45-1024x890.png 1024w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204908\/Screenshot-from-2022-11-26-09-13-45-300x261.png 300w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204908\/Screenshot-from-2022-11-26-09-13-45-768x667.png 768w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204908\/Screenshot-from-2022-11-26-09-13-45.png 1044w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I hear the name Bitnami a lot, but this is my first time using it. Basically, it's a bundle of applications packaged for easy installation and management. Probably. You can do anything with it. I assumed the OS was Amazon Linux 2, but when `yum` didn't work and I wondered what was going on, I realized it was actually Debian.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"368\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204937\/Screenshot-from-2022-11-26-17-05-46.png\" alt=\"\" class=\"wp-image-4029\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204937\/Screenshot-from-2022-11-26-17-05-46.png 651w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204937\/Screenshot-from-2022-11-26-17-05-46-300x170.png 300w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29204937\/Screenshot-from-2022-11-26-17-05-46-320x180.png 320w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br>I also want to connect from the terminal on my local Ubuntu PC, so I downloaded the private key. You can do this right from the orange browser button shown above. Whatever you want to do, you can find instructions for it instantly without even searching.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Just in case, I'll write down the command for my future self.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sh -i [encryption_key] [user_id]@[site_IP_or_name]<br>The username is `bitnami` (which Lightsail creates automatically), the encryption key is the one I just downloaded, and since I set up a temporary server name (the-world-star.com) via Route 53, I can SSH in with this:<br>ssh -i theWorldStar2-Lightsail.pem bitnami@localhost<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Even better, I turned that into a script:<br>echo ' ssh -i theWorldStar2-Lightsail.pem bitnami@localhost' &gt; sshweb2.sh and chmod u+x sshweb2.sh, so in practice...<br>I just run `.\/sshweb2.sh` to log in.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Updating the Hostname IP Address to the New Server in Route 53<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It's best to do this *before* migrating your posts with All-in-One WP Migration. Otherwise, the current temporary server name will get baked into various places. Even if you use a plugin for a bulk find-and-replace, when you check MariaDB, you'll often find remnants left over\u2014it bothered me so much I ended up redoing it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All you have to do in Route 53 is point the destination for `the-world-star.com` to the static IP of this new Lightsail web server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SSL with Let's Encrypt<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Handling the Let's Encrypt certificate is also best done before migrating your posts. I stumbled around and got stuck here. If you search for \"migration,\" a lot of incorrect or outdated sites pop up. Basically, setting it up fresh from scratch is much easier. The official Lightsail documentation explains how.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Official Lightsail Documentation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\t\t\t<div class=\"blog-card\">\n\t\t\t\t<div class=\"blog-card-body-outer\">\n\t\t\t\t\t<div class=\"blog-card-body\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"blog-card-title\">\n\t\t\t\t\t\t\t\t<a href=\"https:\/\/lightsail.aws.amazon.com\/ls\/docs\/ja_jp\/articles\/amazon-lightsail-enabling-https-on-wordpress\">Lightsail \u30de\u30cd\u30fc\u30b8\u30c9\u30c9\u30e1\u30a4\u30f3\u3092\u4f7f\u7528\u3057\u3066 WordPress \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067 HTTPS \u3092\u6709\u52b9\u306b\u3059\u308b - Amazon Lightsail<\/a>\n\t\t\t\t\t\t\t<\/h5>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"blog-card-site-title\">\n\t\t\t\t\t\t\t<a href=\"http:\/\/lightsail.aws.amazon.com\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thttp:\/\/lightsail.aws.amazon.com\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\n\t\t\t<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/opt\/bitnami\/bncert-tool<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"651\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29210303\/Screenshot-from-2022-11-27-17-36-34-1024x651.png\" alt=\"\" class=\"wp-image-4036\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29210303\/Screenshot-from-2022-11-27-17-36-34-1024x651.png 1024w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29210303\/Screenshot-from-2022-11-27-17-36-34-300x191.png 300w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29210303\/Screenshot-from-2022-11-27-17-36-34-768x488.png 768w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29210303\/Screenshot-from-2022-11-27-17-36-34.png 1182w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">No www, no forwarding from www to non-www, forward http to https, register email address.<br>No DNS verification needed. It succeeded smoothly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Just follow the guide and you'll be fine.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Logging Into WordPress<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">SSH into the server you created to find the password.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"894\" height=\"751\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205006\/Screenshot-from-2022-11-26-10-46-59.png\" alt=\"\" class=\"wp-image-4030\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205006\/Screenshot-from-2022-11-26-10-46-59.png 894w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205006\/Screenshot-from-2022-11-26-10-46-59-300x252.png 300w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205006\/Screenshot-from-2022-11-26-10-46-59-768x645.png 768w\" sizes=\"auto, (max-width: 894px) 100vw, 894px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Initially, you log in with the default username and password.<br>The username is \"user\". Surprisingly, it took me about 30 seconds of hunting around to find this info. The password is written in a file located in the home directory after logging in via SSH, so you just display the contents of that file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cat bitnami_application_password\n\napplocation\u3068\u3044\u3046\u306e\u304c\u4eca\u56de\u306ewordpress\u306e\u3053\u3068\u307f\u305f\u3044\u3002<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Migration Process<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Migrating with All-in-One WP Migration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">I'll use the All-in-One Migration plugin to move the site. You install it on the source site and take a backup. It feels a bit overly commercialized and annoying, though.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Export<\/h4>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"434\" height=\"428\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205029\/Screenshot-from-2022-11-26-17-15-25.png\" alt=\"\" class=\"wp-image-4031\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205029\/Screenshot-from-2022-11-26-17-15-25.png 434w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205029\/Screenshot-from-2022-11-26-17-15-25-300x296.png 300w\" sizes=\"auto, (max-width: 434px) 100vw, 434px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br>Open \"Advanced options\" and exclude the media library. Since all my images are stored in S3 anyway and I'll be serving them via S3 + CloudFront, I don't need them in the backup. Anything other than \"File\" as the export destination seems to be paid, so selecting \"File\" creates an archive that you can download right through your browser.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Import<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Next, I'll use the same plugin on the destination server. However, Lightsail WordPress comes with it pre-installed, so you can use it immediately. Use the \"Import\" feature.<br>The default upload file size limit is 80MB. Even with media excluded, my file is 200MB, so I have to change the PHP upload limits. This part is a pain. The plugin documentation has a link on how to solve this, but the free third-party plugin it mentions used to work in the old days and is now gone, making things annoying. The third option is to manually change the upload size limit, but I struggled with this before and couldn't get it to work, so I'm a bit nervous.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Conclusion: The instructions in the All-in-One WP Migration plugin docs are ultimately way too outdated and completely useless.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What does \"Again\" even mean? Or? Next? It's weird Japanese and confusing. Make sure you don't accidentally click through to the paid version.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Changing the Upload File Size Limit<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Following the instructions on the site I introduced at the beginning worked like a charm.<br>The key is to modify `php.ini`. Some sources say you also need to modify `wp-config.php`, but it's an either\/or thing.<br>The tricky thing with Bitnami is that configuration files like `php.ini` are tucked away inside the Bitnami structure, making them hard to find.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Running `php --ini` tells you where `php.ini` is located. Once you find it there, you edit it with an editor.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>emacs \/opt\/bitnami\/php\/lib\/php.ini<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Also, I only know how to use Emacs, so I installed Emacs at this point. I thought it was weird that `yum` wouldn't work, but when my usual Ubuntu command `sudo apt-get install emacs` actually worked, I was like, \"Wait a minute... I thought this was Amazon Linux 2, but it's Debian...\"<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are three places to change:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>upload_max_filesize = 80M\npost_max_size = 80M\nmemory_limit = 512M<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I changed the 80M limits here up to 256M.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>upload_max_filesize = 256M\npost_max_size = 256M\nmemory_limit = 512M<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, restart Apache. Of course, Bitnami has its own specific way of doing this.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo \/opt\/bitnami\/ctlscript.sh restart apache<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Import Results<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Note that importing will overwrite your WordPress login ID and password with the ones from the source site. If you forget them, you'll be locked out, so double-check before doing this.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It worked. Images are displaying, and all my plugins migrated successfully.<br>It started pulling images from S3\u2014specifically from `static.the-world-star`.<br>Was this because of the Offload Media settings?<br>The fact that it's accessing `static` means Route 53 must be routing it to S3.<br>The perks of keeping images on S3.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Even `functions.php`, where I modified code, came across.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is awesome!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Allowing Offload Media to Access S3<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There was one annoying fix needed. If you don't configure the user ID and password to let Offload Media access S3, uploads will fail, and images will be uploaded to this server instead of S3.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The file to edit is: `\/var\/www\/html\/wp-config.php`<br>I hunted down the S3 user info I registered previously and appended it. Be careful where you add it\u2014there's a specific spot. I added it right above `\/* That's all, stop editing! *\/`.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">define( 'AS3CF_SETTINGS', serialize( array(\n    'provider' =&gt; 'aws',\n    'access-key-id' =&gt; 'xxxxxxxxxxx',\n    'secret-access-key' =&gt; 'xxxxxxxxxxxxxxxx',\n) ) );\n\n\/* That's all, stop editing! Happy publishing. *\/\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">CPU Load<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"584\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205059\/Screenshot-from-2022-11-26-10-49-02-1024x584.png\" alt=\"\" class=\"wp-image-4032\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205059\/Screenshot-from-2022-11-26-10-49-02-1024x584.png 1024w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205059\/Screenshot-from-2022-11-26-10-49-02-300x171.png 300w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205059\/Screenshot-from-2022-11-26-10-49-02-768x438.png 768w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205059\/Screenshot-from-2022-11-26-10-49-02-1536x876.png 1536w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205059\/Screenshot-from-2022-11-26-10-49-02.png 1846w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Checking the CPU load is also very straightforward.<br>Much like EC2's t2.micro, Lightsail has a CPU utilization baseline. When usage is below that, it's in a \"sustainable\" state. Exceeding it triggers burst mode, which consumes CPU credits. Once you run out of credits, the instance practically grinds to a halt. The baseline for the lowest $3.50 plan is 5% for 1 CPU, and for the $5 plan, it's 10% for 1 CPU.<br>Lightsail seems to call CPU credits \"burst capacity\". Why change the terminology from EC2? Is it because a different team built it? Or did they rename things to make it more intuitive for users?<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"http:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205118\/Screenshot-from-2022-11-27-11-23-18-1024x642.png\" alt=\"\" class=\"wp-image-4033\" srcset=\"https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205118\/Screenshot-from-2022-11-27-11-23-18-1024x642.png 1024w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205118\/Screenshot-from-2022-11-27-11-23-18-300x188.png 300w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205118\/Screenshot-from-2022-11-27-11-23-18-768x482.png 768w, https:\/\/static.the-world-star.com\/wp-content\/uploads\/2022\/11\/29205118\/Screenshot-from-2022-11-27-11-23-18.png 1213w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You can set up email alerts if something goes wrong with the CPU\u2014like if you're under attack or a Minecraft server goes rogue. This is also super intuitive and easy. You just set the CPU utilization threshold for the alarm (say, 20%) and your email address, then click a test email link to verify. I tried doing something similar on EC2, but it felt too advanced and I never felt sure I set it up right. Here, it's a breeze.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">By the Way, It Didn't Work on the First Try\u2014Lots of Trial and Error<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Tried Recovering Manually from a Minimal Migration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To keep things simple, I excluded media, essential plugins, extra plugins, and themes when taking the backup, resulting in a tiny 17MB file.<br>The destination LightSail instance already has All-in-One Migration installed, so I just need to upload it. Since media is on S3, it should display automatically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since the theme isn't installed yet, posts aren't showing up. There are various unnecessary plugins, so should I restore things one by one while looking at the blog here? I suppose this is how people use load balancers for redundancy, too.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I remember it being a pain if you referenced the IP in WordPress settings and changed it halfway through\u2014would changing it to a domain name later cause issues? -> Conclusion: Even if the IP changed, once DNS was configured and I accessed it by name, the settings updated automatically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After switching to a static address,<br>Log back into WordPress using the new IP address. It's annoying because your browser remembers the old password. It's better to assign a static address shortly after creating the instance. The IP in the WordPress settings has updated to the static one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Recovery Work<br>1. Install the Lightning theme<br>The blog started showing up again. Categories and stuff are displaying, but my custom code isn't.<br>Images aren't showing. Need to configure S3 and CloudFront in Route 53.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Configuring S3 + CloudFront<br>Install the Offload Media Lite plugin.<br>Need to configure IAM user passwords and other settings to access S3.<br>Starting to feel lazy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3.<br>Getting tired of this, so I decide to try a full recovery including media.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Adding a DNS Record in Route 53<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This wasn't strictly necessary, but I wanted to test it and access the site by name. Without really knowing what I was doing, I guessed this was how it's done and added an A record in Route 53 pointing to the static address.<br>`web2.the-world-star.com` stands for Sub Web Server #2. Once migration is complete, this will become the main server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Doing this *before* migrating with All-in-One Migration was a mistake. The URLs in various places ended up as `web2.~`...<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u25a0 I Dared to Update the Lightning Theme<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The custom features I added via code disappeared.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I'd been messing with code so much that I was afraid to update the Lightning theme, but when I tried it on this server, sure enough, all my customized code got wiped out.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br>Root `functions.php` edits:<br>\u30fbAutomatically change post slugs to `post***` when they are in Japanese<br>\u30fbShorten date displays in archives<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u30fbIn Lightning's \"Previous Post\" and \"Next Post\" navigation, only show posts from the same category<br>Edited Lightning's `next-prev.php` file,<br>Changing `$in_same_term` to `true`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u25a0 Things look kind of broken. Time to start over from a backup restoration.<br>I feel like just updating the Lightning theme broke things.<br>I'll try again another day. Calmly. Systematically. After writing a summary page first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ugh, there's no end to this. Failed. Restarted the import from scratch. I'll write a summary article of my custom code modifications before trying again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since it's public, I'm worried. Should I delete it from DNS?<br>There are no links pointing to it from anywhere, so it's probably fine, right?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article is a log of my journey migrating my web server from EC2 to Amazon Lightsail.Also, this is just a test post before the actual migration. My AWS free tier is ending in just a few days. EC2 is a bit too pricey for a basic web server, so I was considering downgrading to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2606,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"https:\/\/175.41.248.22\/?p=4022","_lightning_design_setting":{"layout":"default"},"footnotes":""},"categories":[3],"tags":[67],"class_list":["post-6590","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-server","en-US"],"_links":{"self":[{"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/posts\/6590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/comments?post=6590"}],"version-history":[{"count":1,"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/posts\/6590\/revisions"}],"predecessor-version":[{"id":6591,"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/posts\/6590\/revisions\/6591"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/media\/2606"}],"wp:attachment":[{"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/media?parent=6590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/categories?post=6590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/the-world-star.com\/wp-json\/wp\/v2\/tags?post=6590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}