Excited from my recent AWS certification training. I made the bold decision to move my blog, website and domain from my current hosting provider to Amazon We Services. Doing so will allow me to be my own hosting provider and have complete control.
From my training and day to day work I know AWS S3 is the best choice to replace the hosting for the IOT Mirror Project. AWS is very intuitive and user friendly. It took me less than 5 mins to move over my IOT Mirror Website. I am not going to go through how to create a free AWS account as it is super simple. I am just going to go through the steps I took to move the IOT Mirror project.
The first step was getting all my static website files off my old hosting. Use your ftp account associated with your hosting to copy across all the files. In my case I used the free program Filezilla to ftp into my hosting and copy across my IOT Mirror files into a folder on my local pc.
The second more fun step was setting it up on AWS.
- Login into AWS management console
- Click services
- Looked for the category Storage
- Click on S3
- Click Create Bucket
- Enter in a name for you bucket (In my case myiotmirror)
- Select your local region (In my case Sydney)
- Click Create
- Click on your newly created bucket
- Click Upload
- Upload all your files (In my case I didn’t have any folders, if you have folders you will have to create them)
- Wait for you files to copy across
- Double check all your files are there and folder structure is the same
- Click on the properties tab
- Click static website hosting
- Tick “Use this bucket to host a website”
- For the Index document, type in the name of html file that I your landing page ( In my case Mirror.html
- You have the option to type in an error.html page. This is really cool because it allows you to create a super simple 404 page.
- The endpoint up the top is how people get to you website ( http://bucketname.s3-website-ap-southeast-2.amazonaws.com)
- Click Save
- Now if you try to go to the endpoint you will get an access denied message
- Go back to your bucket
- Click Permissions
- Click Bucket Policy
- Copy and paste the below policy
The above policy is an allow. Principal is * meaning everyone. Action is Get object which allows everyone to read from the bucket. Lastly the resource is simply the bucket this policy applies to. Remember to change bucketname with your bucket name or it will throw an error.
- Click Save
- Go to that endpoint in your browser
Congratulations you have just host a simple static website on aws.
Now my mirror project is just a website for my mirror to access so I don’t care about the url.
But you can take it a step further and replace the endpoint with your domain name. To do this go to route 53 and purchase the domain name you want (In another tutorial I bought lloydmcallister.io). Important use all the default settings and allow Route 53 to setup all the DNS information.
While you wait 24 hours setup you bucket. Do the same steps as above except when naming you bucket name it exactly the same as your domain. (In my case my bucket was called lloydmcallister.io)
When you receive the notification your domain is ready and you have a bucket with the exact same name setup you can proceed with the next step.
- Go to route 53
- Click hosted zones
- Click on your Domain Name
- Click Create Record Set
- Select yes for alias option
- Click on the alias target box and select the aws S3 bucket you created
- Click Create
Congratulations you took it a step further and have you domain as the URL.