Hosting Websites On AWS For Free- Step By Step Guide

In this detailed article on hosting websites on AWS, we will learn how to host a website on AWS, discover the different AWS hosting plans, learn about the AWS web hosting pricing, and discuss a few related topics such as the following:

  • What is AWS Hosting?
  • How to host a website on AWS S3?
  • What are the steps for hosting a website on AWS EC2?
  • What is the cost of hosting a dynamic website on AWS?
  • AWS Web Hosting Pricing Plans
  • How to host a website on AWS Lambda?

What Is AWS Hosting?

Amazon Web Services (AWS) is a public cloud platform that offers a lot of services like computing, ML, also cloud web hosting services to businesses, individuals, and governments at inexpensive prices. It is a public cloud that allows others to rent a share of massive server farms and data centers.

AWS offers website hosting services, application hosting services, file hosting services, and database hosting services, in addition to other types of hosting. It is one of the biggest cloud infrastructures, with notable companies like Netflix using its services.

What is AWS & How It Works
What is AWS & How It Works

AWS made about 32% of global cloud infrastructure in the first quarter of 2021. It offers a diverse mix of over 200 different services.

hosting websites on AWS s3- Step by step

If you are a beginner with no prior knowledge or experience with AWS, then here you will know How To Host A Website On AWS S3? First you will have to create an AWS Account, dont worry its free and you dont have to pay anything upfront. You can use the free tier that will cover most of the things for a beginner.

Follow along and we will be hosting a website together in AWS:

1. Signing Up on AWS

Create an AWS account here.It’s free.

2. Hosted Zone Creation With Route 53

Now the first thing that you would want to do is to set up a hosted zone on Route 53. It is where your DNS requests will be taken care of. This step is going to be very easy if you purchase the domain through AWS because once you purchase the domain, a hosted zone will be created.

But if you did not purchase your domain through AWS, go to Route 53 and select the “Create Hosted Zone” option. Now fill in all the details, select a “Public Hosted Zone,” and hit the “Create” option.

See also  What Is RDS In AWS: Overview Of Amazon RDS and Features

You will now need your Name Servers records. For that, log in to your domain name registrar and find the settings for “Nameservers,” which is an editable section. Now copy down the AWS NS records and change the current Name Servers records in the domain settings.

Make sure you don’t copy the period at the end of the “.com.”. It should be like this “.com” The process will take 24 hours to sync. Go ahead and set up your S3 buckets in the meantime.

3. Setting Up the S3 Buckets

S3 buckets are an S3 resource where you store your data, such as your index.html files. You will need to set up two S3 buckets for your website: one for yourdomain.com and one for www.yourdomain.com.

In the first bucket, you will store all your documents, including your index.html file. The second bucket will be used to redirect to the first one.

Follow the official AWS step-by-step manual to see how you can set up the S3 buckets. But before you follow this manual, you should note the following points:

  • Under part 2 of section 2.1, click on “How Do I Create an S3 Bucket?” for configuration and setup of S3 bucket.
  • Under part 3 of section 2.1, you don’t need to upload the files already. Just add a test index.html file for now.

Pay attention to your endpoint. In your S3 bucket, go to the “Properties” tab and click on the “Static Web Hosting” box. The endpoint will appear similar to this:

http://yourdomain.com.s3-website.eu-east-2.amazonAWS.com

4. Setting Up Your Alias Records

Now open your hosted zone by going back to Route 53 in order to add your Alias records. Follow Step 11 in AWS official document to see how it works.

You will be able to see your site as and when the NS settings are set up in 24 hours. Check it out with the URL yourdomain.com. Secure your website by adding an SSL certificate.

5. Getting the SSL Certificate for the Website

Obtain the SSL Certificate with AWS Certificate Manager. To begin, click on “Request or Import a Certificate with ACM.”

Now add both your domain and your subdomain to the certificate and click on “Next.” Do as directed and choose a validation method. Select “DNS validation” and hit the “Review” option. Finally, click on “Confirm and request.”

A Validation page will appear. Click on the arrows next to both the domains to see the detailed information. Under each domain, click on “Create a record in Route 53”. This will be used by ACM to validate that you are the owner of those domains.

Click on “Continue.” The validation may take some time, and you will see the states saying “Pending validation” on the console. Once validated, the status will change to “Issued,” and you will be able to see the certificate in the dropdown list in “Custom SSL Certificate.”

Click on “Create Distribution” to set up your CloudFront. It will also take some time, and once AWS does it, you will see the status change from “In Progress” to “Deployed.”

See also  Change Data Capture in AWS: Pros, Cons, How To Use CDC

That’s how to host a domain on AWS, fellas! But that’s only for static websites. For dynamic websites, you will need to use EC2.

What are the steps for Hosting a Website on AWS EC2 or Lightsail?

For static websites, AWS uses S3. But if you are wondering how to host a dynamic website on AWS, you will need to use EC2 or Lightsail. Hosting a PHP website on EC2 instance using Cloudways requires you to follow these steps:

  1. Launch a server.
  2. From the dropdown menu, select the “PHP Custom Web Application” option.
  3. Name your managed app and server.
  4. Select AWS as your cloud provider.
  5. Now choose a storage, bandwidth, and server size for your website.
  6. Select the server location.
  7. Finally, hit the Launch Now button.

This is for hosting a website for Windows. For Linux, you will need to follow other source guides.

What is the cost of hosting a Dynamic Website on AWS?

A typical dynamic WordPress website hosted by AWS on a reserved instance will only cost as low as $6 per month.

AWS Web Hosting Pricing Plans

AWS is an inexpensive web hosting service. As we all know AWS bills us as per our usage of the resources at any time.

No upfront payments no long-term contracts that are the beauty of using AWS. It offers two options, a pay-as-you-go pricing plan and a fixed monthly pricing plan.

Most of the static websites will fall under the free-tier option, which is an AWS free web hosting offer for static websites.

Steps for Hosting a Website on AWS Lambda for Free

AWS Lambda is based on the concept of a Serverless Computing platform that can be used to host websites without a server setup. You can easily write a code as a Lambda function in any of the supported languages and let AWS Lambda take care of the rest.

The Lambda function can perform anything from calculations and using other AWS services to returning an HTTP response object. Since Lambda operates in response to events, it means that the hosted function will be used whenever an event occurs.

AWS Lambda can take as many as 1 million requests per month. That, too, is for free because the free tier does not expire in 12 months or so.

steps for Hosting wordpress site on AWS

AWS has provided us with a service called Lightsail which can be used to host a WordPress website with a few button clicks. Let’s see step by step approach for doing it:

  1. Login to AWS and navigate to Lightsail.
  2. Create Instance.
  3. Next you have to select the Region and the AZ where you like to deploy the instance.
  4. Select the platform and the blueprint as wordPress.
  5. Next choose the plan that suits your budget and requirement for your site.
  6. Name your instance, Create Instance.
  7. Connect or SSH into your instance from the option available there and run this command to get the wordpress site password – cat $HOME/bitnami_application_password
  8. This will be used when you connect to the admin console of the WP site.
  9. In the browser open http://IPAddress/wp-login.php, IP Address is the public ip of the WP site which can be seen in the instance page. Fill in the username as user and the password is the one we obtained in step 7 above.
  10. Its advisable to use a static IP for your WP site because incase if the instance restarts the IP will change and the site will not be reachable. We can get the same from the Networking tab of the lightsail page.
  11. Create a DNS zone in the networking page and use the domain you have registered for your website. This will give a friendly name to your website.
  12. Yay!! You have just now created a WP website of your own.
See also  What Is AWS Well-Architected Framework: 6 Pillars, Benefits

how to host php website on AWS

  • Launch an EC2 instance with Linux in it.
  • While launching make sure the security group has http and https ports opened for access from anywhere.
  • Use the ppk/pem file to SSH into the EC2 machine just created using putty.
  • Update your EC2 instance, install apache and php.
  • Make sure to restart service once installation is completed.
  • Install php admin as well now.
  • At this point our environment to create a site is ready. So, lets deploy our site now.
  • Copy the content of the php site to /var/www/html folder in the EC2 machine. You can choose filezilla to do the copy.
  • You have your site up and running, you can open it with the public ip of the EC2 machine.
  • If its a permanent site then give a static Ip to your EC2 machine.
  • After that if you have the domain of your choice the make an entry in the Route 53 and make an A record to route traffic to your website using your domain name.

Frequently Asked Questions

Q1. What is the Cost to Host A Website On AWS?

Well, the cost is a variable factor here and it completely depends on the services used. If you are under the AWS Free Tier, it will be free for you. But if you are outside of the AWS Free Tier, it will cost you roughly $1 to $6 per month.

Q2. Can We Host A Website On AWS?

Anyone can host their website on AWS. AWS also facilitates CDN for your sites for faster response. Any individual, business, group, or government can host their websites on AWS. It is open to all.

Q3. Is Heroku Better Than AWS?

Heroku is only recommended to startups or small businesses. Amazon Web Services (AWS), on the other hand, is ideal for medium businesses and large enterprises.

That’s because Heroku can efficiently handle low computations, whereas AWS can deliver high computation demands.

Also, find below the AWS article for more info.

Conclusion

We covered a lot of different ways of hosting sites on AWS. Not only that, we also found out how AWS web hosting pricing works, we saw how to host a website on AWS S3 and EC2, and we answered all your queries regarding AWS web hosting.

Happy reading and watch out for more contents!!

  • What is AWS Hosting?
  • How to host a website on AWS S3?
  • What are the steps for hosting a website on AWS EC2?
  • What is the cost of hosting a dynamic website on AWS?
  • AWS Web Hosting Pricing Plans
  • How to host a website on AWS Lambda?

Leave a Comment