Creating EC2 Instance in AWS in Simple Terms

AWS is the most trusted and one of the most used hosting services around the world. Hosting a wordpress website to an AWS instance is not different than hosting directly to usual hosting providers but said here are certain configurations and tools to start deploying wordpress to EC2 servers for higher performance and security. AWS provides certain services which ensure scalability, reliability and performance with services like Elastic IP, Load Balancer, Cloudflare, S3 and hosted database services.

Go through the following steps to start hosting wordpress to EC2 :

  1. Sign up to AWS and create an account.
  2. Login to your AWS account console
  3. Click on services menu at the top menu and search for EC2

4. When EC2 is selected you will be taken to an EC2 dashboard where you can click on "Launch Instance" button.

5. You will be taken to the following page where you will have to provide details regarding the server. This includes operating system, name of the server, size of the instance, Firewall rules and storage volume.

Select your desired operating system. AWS has a wide variety of operating system choices which you could use to run the server in. Our choice would be ubuntu because of their great community support as availability of packages.

Select Instance Type

Selecting an AWS instance type if where the decision affects the budget of the implementation. These can be upgraded in future. You can start with the free tier t2.micro system.

Create Key Pair

We access the AWS instance using key files. before we launch the instance aws will ask you to select a key pair, if not selected we should create one to secure our sever. If you want to create a new key pair click the "create new key pair" text.

Create New Key Pair and Keep it private

You will be prompted with the following form when you are trying to create a new key pair. Once created a "filename.pem" file will be downloaded by your browser. Keep the key secure.

Configure Network Settings

Configure root Storage volume

After this you can click on launch instance. Your EC2 Server will be created.

To Connect to terminal to AWS instance just created. Just use the following command on your Powershell or Linux Terminal

ssh -i <your key pair> <instance id>

example : ssh -i mynew_key

you can get the whole command by clicking at connect at the top of the page and selecting SSH. While you try to connect make sure the key downloaded to the system has to have restricted access. If when trying to login you have a permission issue just use the following method.

chmod 400 mykey.pem

Use this permission to the key file and try to access the server again. Also make sure you have inbound and outbound rules have access to port 22. To change this we will have to add the security groups rules to AWS instance created. You can find this under security section of the Instance detail view.

In the coming parts we will cover the following topics :

  1. Connecting Wordpress in AWS EC2 to Amazon RDS
  2. Connecting s3 to Wordpress in AWS EC2
  3. Securing Your Wordpress Installation