How to Launch an EC2 Instance through the AWS Management Console
AWS EC2 provides a very broad choice of instances and several instance types that suit different types of workloads. Especially, if you are looking to start a simple blog, you can launch an EC2 instance and host your Wordpress blog from a starting price of as low as $5. If you are eligible for the free trial, you can start one for free. EC2 instances provide good speed and performance. AWS provides several instance types which are mainly placed in five categories – General Purpose, Compute Optimized, Memory optimized, Accelerated computing, and Storage optimized. You can start with a General Purpose instance if you want to start a simple blog or website. Even in this category, you have a very wide range of choices at surprisingly low costs.
So, first create an AWS account so you can launch EC2 instances and run your web application. Login to your account and go to the EC2 dashboard. Search for EC2 in the search box at the top and then click on it. Once you are inside the EC2 dashboard, click on launch instances button at the top right.
Select Amazon Machine Image (AMI):
It will take you to the next page where you can begin instance creation starting with giving your instance a name. Give your instance a name like example-server. Now, you need to select an AMI (Amazon Machine Image) which includes the OSA, application sevrer and application required to launch the instance. In the quick start section, you will find various Linux distributions like Ubuntu, Red Hat, SUSE, as well as Mac OS and Windows. The default selection in this category is the Amazon Linux 2 AMI. In that case, you will need to install the webserver, Apache or Nginx and then the CMS and database if you are planning to launch a Wordpress website.
So, if you are planning to launch a wordpress website, you can avoid all the pain and directly select the AMI which will install wordpress, php, Mariadb and other essentials required to run a wordpress website. Click on Browse more AMIs and then search for wordpress. You can select one option from the available choices. However, if you want a simple wordpress installation with PHP, Apache webserver, Wordpress and Mariadb database, you must select – Wordpress certified by Bitnami and Automattic. The default installation will also include AIOSEO and Jetpack plugins. Under the pricing tab for the AMI, you can check out the pricing and change the instance type to one that suits your needs. The vendor recommended instance type for this AMI is t3a.small but you can also select a larger instance if you like. Click on continue at the bottom (right) and it will bring you back to the EC2 instance creation page to complete the next steps. In the instance type you will find the vendor recommended t3a.small selected or you can change it if you like.
Otherwise, you can first select the OS, like Amazon Linux or Ubuntu and then install the webserver on it later.
Create a Keypair and Security Group
Next is the key pair (login) section. Click on create a new key pair and the system will create a new keypair for you. In the network settings, click on create security group for the firewall and allow ssh, http and https traffic. The security group is like a firewall that determines the type of incoming and outgoing traffic for your instance, the three rules that you have just set are the inbound rules for your instance and every instance under this security group.
Launch the instance
Move on to storage configuration. You can increase the storage to 20gb or leave the default selection of 10gb. At the end, click on launch instance. Your instance is being created and it does not take very long to create and initialize the instance. You will get the success message, once instance creation is complete.
Go back to the EC2 dashboard and click on instances. Click on the instance id of the instance you just created and you will see that the instance state changes to running a little later. Usually, the process is very quick and, in a few minutes, you will be able to ssh into your instance. To connect with your instance using SSH, click on connect on the instance summary page. You will find the button at the top left and it will open the connect page for you. Under EC2 instance connect tab, click on the connect button at the bottom to connect with your instance.
Every EC2 instance is assigned a public and a private ip. You can use the public Ip, which you will find on the instance summary page (click on your instance id) to check out your wordpress installation if you have selected the Wordpress by Bitnami for AMI. If not, then move on to installing webserver if you have selected to start with an OS like Ubuntu or Amazon Linux2. In the case of wordpress by Bitnami AMI, the public ip of your instance will take you to your wordpress installation.
Make changes to your DNS records, changing the existing A records and apply the public Ip of your instance to connect your instance with a custom domain name. To find information on user name and password for your Wordpress installation go to the Wordpress by Bitnami page in AWS marketplace where you will find instructions related to usage. You can go to your instance summary page and then click on Actions -> Monitor and Troubleshoot -> Get System Log. Scroll up in the system log and you will find the user name and password. Use them to login to your wordpress installation.
If you have selected Amazon Linux, Ubuntu, or another distribution for your AMI, then you can install the Apache server and then Wordpress, PHP, mysql and other essentials.
If you want to delete an instance you have created, then you can do so from the EC2 dashboard. Select the instance and then click on instance state and then terminate instance.