Struggling to find the right platform to host your website on? Amazon, believe it or not, specialises in web hosting as well as online shopping and entertainment. But why should you use their services, and how can you get started?
The major benefit of using AWS lies in the fact that it is flexible. Its EC2 service gives you full access to a broad and versatile server. So, the things you can do with AWS will likely outstrip other basic hosting solutions.
To host on AWS, you can follow one of two methods:
- Use EC2, and build your application from scratch;
- Or use an elastic beanstalk – which will let you launch an application using a separate console.
While many people choose to use an elastic beanstalk backend, direct EC2 uploading offers stacks of flexibility. In this guide, we’ll be looking at direct application control only.
How to Host a Dynamic Site on EC2
- Let’s take you through the basic steps of getting a dynamic site up and running on EC2 via Amazon AWS.
- Make sure to launch an instance, to begin with. This is simple to do through the AWS backend.
- Connect to the instance you have created by using putty. This is a separate plugin you’ll need to download, but it shouldn’t add too much time or hassle to the process.
- From here, make sure to update the server with the command ‘sudo apt-get update’.
- Then, install your web server using the command ‘sudo apt-get install lamp-server^’. This will ensure that you have access to coding languages and an apache server.
- Locate your instance’s public DNS. Copy it, and paste it into a browser address bar, before hitting ‘go’.
- If you’re given a message stating ‘it works’, then – enough – the server works!
- From here, you are going to want to start uploading web pages. You’ll find the folder for web pages via the command ‘cd /var/ www’.
- Make sure you use a web page uploader program such as Filezilla to upload the content you desire. You should focus on uploading CSS, HTML and PHP files into this folder, but be sure to erase the existing index.html in there first. You’ll be able to find your own index.html by visiting your own DNS.
How to Host a Static Site
Prefer to host a static website instead? You’ll need to make use of Amazon’s S3 dashboard. You’ll only be able to host dynamic sites on EC2, so make sure you know which type of site you’d prefer to manage.
- As with EC2, make sure to design and save any web pages you’d like to go live on your local device. You’ll need to upload them to S3 shortly.
- S3 is managed through the use of buckets. To start with, you’re going to need to log into Amazon AWS through the S3 dashboard.
- Once logged in, make sure to create your first bucket, and to create a website address or name.
- Click ‘upload’ or ‘add files’ to begin adding your pages to the bucket. choose from an uploader screen which will pop up.
- Click ‘make it public’ once you’re happy with what you’ve uploaded.
- You can set up a custom S3 address for your website – which you may wish to do, as some bucket addresses can be a little lengthy!
Whether you prefer dynamic or static hosting, Amazon offers a refreshing, user-friendly interface which you can easily get started with. Take a look!