
Enable auto start of Apache and MySQL serverĭownload the script from below or copy the script which is at end of this post.Update wp-config.php with provided database value.Install secure MySQL, assign root password, create database ,user and password.Download WordPress and extract files to var/www/html folder.Update packages and install LAMP server.After several testing, the final script was prepared. I did some research on the Linux shell script and tested it against EC2 AMI. I have prepared all the scripts needed to install WordPress and experimented with EC2. Whether you connect to SSH and type all the commands or use user-data, end result is the same so why not use user-data instead? If you want to host WordPress in AWS with your own dedicated virtual server but don’t want to go through all setup processes then you can use user data to automate steps for you. It will give you a clear explanation of each shell command line involved. Before beginning this tutorial I want you to know how to install WordPress using SSH terminal first. In this tutorial, I am going to show you how to install WordPress without using an SSH terminal.

Using shell scripts in user-data you can install the package automatically. Suppose you are experimenting with some commands but you don’t want to connect to SSH and type each command line by line then User-data is your solution. This is helpful when you want your newly created instance to be in a certain state with certain packages installed, or with a certain custom configuration. When you launch an instance in Amazon EC2, you can pass User-data to the instance that can be used to perform automated configuration tasks or run scripts after the instance starts. This tutorial is mainly based on script suitable for Amazon Linux 2 AMI and AWS Ubuntu Server 20.04 LTS
