{"id":97,"date":"2025-01-04T07:25:10","date_gmt":"2025-01-04T07:25:10","guid":{"rendered":"https:\/\/firewallsudhan.in\/?p=97"},"modified":"2025-01-08T14:10:39","modified_gmt":"2025-01-08T14:10:39","slug":"migrate-wordpress-from-aws-to-oci","status":"publish","type":"post","link":"https:\/\/firewallsudhan.in\/index.php\/2025\/01\/04\/migrate-wordpress-from-aws-to-oci\/","title":{"rendered":"Migrate WordPress from AWS to OCI"},"content":{"rendered":"\n<p>AWS turned out to be super costly for running a simple wordpress website on a single T2 micro VM (on-demand plan) with both apache webserver and mysql database. The overall cost came around 1400 INR for a month.  With savings plan for 1 year\/3year, we could get around 30% discount. It would be still be 1000+ INR for a month. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"375\" src=\"https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-1024x375.png\" alt=\"\" class=\"wp-image-98\" style=\"width:705px;height:auto\" srcset=\"https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-1024x375.png 1024w, https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-300x110.png 300w, https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-768x281.png 768w, https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-1536x562.png 1536w, https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-2048x750.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I started evaluating other options like BlueHost. But they rely on certain plugins for migrating the data. By chance, I happen to see that Oracle Cloud Infrastructure offers a free tier that says &#8211; 2 VMs with 1VCPU and 1GB RAM free always.  The free tier comes with 400 SGD.<\/p>\n\n\n\n<p>With Azure, GCP and AWS, I had only a single VM. With OCI, I deployed the apache web server and mysql database separately on 2 VMs with Ubuntu 24.04. Thanks to OCI&#8217;s pricing model and free tier, I could deploy VMs within India. I am OK with the performance for now. If needed, I will switch to a lighter OS and switch to nginx.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"171\" src=\"https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-1-1024x171.png\" alt=\"\" class=\"wp-image-99\" srcset=\"https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-1-1024x171.png 1024w, https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-1-300x50.png 300w, https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-1-768x128.png 768w, https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-1-1536x256.png 1536w, https:\/\/firewallsudhan.in\/wp-content\/uploads\/2025\/01\/image-1-2048x342.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Overall, the migration steps were almost same (see <a href=\"https:\/\/firewallsudhan.in\/index.php\/2024\/11\/23\/migrate-wordpress-from-gcp-to-aws\/\" data-type=\"link\" data-id=\"https:\/\/firewallsudhan.in\/index.php\/2024\/11\/23\/migrate-wordpress-from-gcp-to-aws\/\">GCP to AWS<\/a> migration). Created a tar file from \/var\/www\/html and used mysqldump to export the data to .sql file. Once the VMs are ready, untar the .tar.gz file and import the .sql file to database.<\/p>\n\n\n\n<p>With OCI, though I had the VCN and security lists with ingress rules for 80\/443, I still had to enable the firewall rules at the Linux system level. Only after executing the below iptables command, I was able to provision the SSL certificates via certbot for my domain. <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>sudo iptables -I INPUT 6 -m state &#8211;state NEW -p tcp &#8211;dport 80 -j ACCEPT<\/p>\n\n\n\n<p>sudo iptables -I INPUT 7 -m state &#8211;state NEW -p tcp &#8211;dport 443 -j ACCEPT<\/p>\n<\/blockquote>\n\n\n\n<p>curl command helped to troubleshoot and isolate the port issue. &#8220;curl http:\/\/localhost:80&#8221; was working and &#8220;curl http:\/\/&lt;PUBLIC_IP&gt;:80 failed with &#8220;Could not connect to server&#8221; error.<\/p>\n\n\n\n<p>Since the database mysql-server was on a different VM, I had to make changes to that VM as well. Enabled port 3306 (default mysql port) for ingress and also update the binding address in \/etc\/mysql\/mysql.conf.d\/mysqld.cnf file to 0.0.0.0 instead of localhost.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>bind-address = 0.0.0.0<br>mysqlx-bind-address = 0.0.0.0<\/p>\n<\/blockquote>\n\n\n\n<p>The privileges of wp_user was also bound to localhost in the past. I modified the SQL commands also to use &#8216;%&#8217; instead of &#8216;localhost&#8217; in the SQL queries.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>ALTER USER &#8216;your_user&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;user_password&#8217;;<br>GRANT ALL PRIVILEGES ON <em>.<\/em> TO &#8216;your_user&#8217;@&#8217;%&#8217;;<\/p>\n\n\n\n<p>FLUSH PRIVILEGES;<\/p>\n<\/blockquote>\n\n\n\n<p>Do not forget to restart mysql and apache after any of the above config changes before testing.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>sudo systemctl restart mysql<\/p>\n\n\n\n<p>sudo systemctl restart apache2<\/p>\n<\/blockquote>\n\n\n\n<p>I initially struggled to assign a reserved IP to an already created VM. Later, I ended up creating a new VM and was able to assign a previously created reserved ip address to it. <a href=\"https:\/\/docs.oracle.com\/en-us\/iaas\/Content\/Network\/Tasks\/reserved-public-ip-assign.htm\">https:\/\/docs.oracle.com\/en-us\/iaas\/Content\/Network\/Tasks\/reserved-public-ip-assign.htm<\/a><\/p>\n\n\n\n<p>If you are new to OCI, apart from the free tier, there are also free learning materials for <a href=\"https:\/\/education.oracle.com\/oracle-cloud-infrastructure-2024-foundations-associate\/pexam_1Z0-1085-24\">Oracle Cloud Infrastructure 2024 Foundations Associate 1Z0-1085-24<\/a> certification exam @ <a href=\"https:\/\/mylearn.oracle.com\/ou\/learning-path\/become-an-oci-foundations-associate-2024\/139374\">https:\/\/mylearn.oracle.com\/ou\/learning-path\/become-an-oci-foundations-associate-2024\/139374<\/a>. This exam is retiring soon &#8211; Feb 13, 2025. Until then, the exam is free and covers foundational topics.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWS turned out to be super costly for running a simple wordpress website on a single T2 micro VM (on-demand plan) with both apache webserver and mysql database. The overall cost came around 1400 INR for a month. With savings plan for 1 year\/3year, we could get around 30% discount. It would be still be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[23],"tags":[15,25,24],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-oci","tag-hosting","tag-migration","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/comments?post=97"}],"version-history":[{"count":3,"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":103,"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/posts\/97\/revisions\/103"}],"wp:attachment":[{"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/firewallsudhan.in\/index.php\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}