Simple Website Hosting in AWS using EC2

I come across with lots of requirements from my clients asking that, “Hey I want to host my wordpress website in AWS. Can you guide us? I understand that AWS is very costly, can you help me migrating the website from existing service provider like godaddy, hostinger or cPanel shared hosting? What will be the charge? etc. etc. “

There are lots of content available on web if you find how to host WordPress site on EC2 server or using AWS lightsail services. However, i thought to give some highlights my experience on hosting and migration activities:

Free Tier  AWS Account:

You can easily create your Free Tier account in AWS console https://portal.aws.amazon.com/billing/signup

Once your account is ready to use, go ahead and launch EC2 server. Now, there are lots of options here, which one to choose for your site. For e.g. if you have already existing site on wordpress, you can choose ready-made bitnami marketplace app or you can choose ubuntu AMI to launch your instance. There are ready-made AMIs on ubuntu with LAMP config also, or you can take vanilla and deploy the setups of Apache, MySQL, PHP and WordPress by yourself as well.

Step 1: Launch New AWS ec2 Instance from your EC2 dashboard.

Step 2: Make sure that you have chosen right set of ports in Security group e.g. port 22, 80, 443 etc. Then connect your AWS EC2 Instance from SSH.

Step 3: Install Apache 2 on ubuntu.

You can use apt-get install command

Step 4: Install MySQL.

Step 5: Install PHP 7.3/version xx (supported one).

Step 6: Install WordPress and configure as needed. Once the configuration is done, you are good to go.

Speed of the website:

I also got an opportunity to work with the clients who says, inspite of being on AWS, the speed of the site is very slow. In my observation, sometimes I see the used instance in AWS ec2 are either overutilized on the resources. But that’s not the case always. Website speed depends upon lot of factors on top of what resource you have used for hosting. For e.g. what technology you have used, images/video [media files] used on the site, are they optimized enough? sometimes people use scripts to do the various analysis of the site performance, they also become reasons for slowness of the websites if you have used multiple scripts. I also have observed DNS itself is very slow in resolving the requests. In few of my migrations projects, Nameserver change on DNS side takes more than 48 hours to resolve fully, this ofcourse varies across various service providers. I definitely recommend Route53 DNS service of AWS which is faster as well very much flexible for resolving various queries with different set of rules:

I also recommend to use the good CDN service for caching your site to nearest location for reducing the latency. However, using right TTL is also the key here, else it may create an issue. It depends upon how frequently your website is getting updated. In my case I have used Cloudfront in various websites, but you can use akamai CDN or Tata Communications CDN also, which is good in performance. The client wisely choose their CDN service providers depending upon the volume of data transfer and number of connections.

Basic Security of website:

I come across with the cases where in WordPress site hosted on any hosting platform, gets hacked or compromised with malicious contents. In my experiences of AWS services, client sometimes believes that it is in AWS, so nobody can attack on my site: it is a myth. Cyber Security is the biggest concerns today observing the number of attacks happening everyday in very much sophisticated way. Everyday new attack behaviour/patterns are generated and most times, our applications gets trapped. Few suggestions from my side on AWS hosted platforms:

  1. First and foremost the right set of security group rules for inbound access is must. If you keep your instance open to the world, then there is a possibility of your site may come under attack.
  2. Encryption methodologies: please use the needed encryption methods as per your workload and usecase.
  3. SSL certificate on site – please ensure your site is SSL secured. You may go with free SSL from Let’s encrypt as well if you don’t have any SSL issued from CA.
  4. Moderation on comments on blogs
  5. DDoS prevention – proxy mechanism helps.

Thank you everyone for going through this blog. This is my experience I have shared, I might have missed lot of points or may not have covered in detail. If you need any help please reach out to me on [email protected]

Leave a Comment