There are numerous hosting providers that allow you to host your website on their server and enable you to manage your website files using SFTP. If you happen to have an AWS account and enjoy DIY, you can easily setup S3 website + SFTP within a few minutes.
Create an S3 bucket, the bucket name must be exactly the same as your domain, in my scenario, I have mianio.com hosted zone managed by Route53, so the bucket name must be something.mianio.com. You will need to untick
Block all public access because your website needs to be pubic accessible.
Once it is created, Static website hosting needs to be enabled.
Configure Bucket policy to allow Public read
S3 bucket is ready, now we need to configure Route 53 to link the domain to the bucket.
Go to Route 53 hosted zone, create record set, the name of the record set is the domain of your website, ie the name of the S3 bucket we just created, in my scenario it is static-website.mianio.com. Choose Alias Yes, choose the S3 website endpoints from the list.
Go to AWS Transfer for SFTP to create an SFTP server.
Choose Public as the endpoint type unless you need your SFTP server needs to live in VPC.
You can choose a custom hostname so that you can connect to your SFTP server using a meaningful domain name, such as sftp.mianio.com. If you choose None the server name will be an AWS domain name.
To keep this demo simple, I’ve left Logging Role empty.
Once the server is created, we need to add users to access the server.
First of all, we need to create an IAM policy which gives the SFTP user access to the S3 bucket, the policy is as below
Now we can create the IAM role, and attach the policy to the role.
And make sure Trust relationships is as below
Go back to the SFTP server and add a user. Assign the Role we just created to the user, the Home directory will be your S3 bucket, lastly enter your public key.
We are all set and ready, you can connect to the SFTP server and upload your file. I use Cyberduck as the SFTP client, you may use FileZilla or whatever you like.
The server name will be your custom hostname, or if you do not have a custom hostname, the server name will be your Server’s endpoint, such as below
Leave the password empty, and choose your private key
Click Connect and upload your index.html.
It’s immediately live on http://static-website.mianio.com/, yay!
AWS charges for both the SFTP server running and file transfer. By server running, it means both ONLINE and OFFLINE. So if you don’t want to see a surprising bill make sure you delete the server. See https://aws.amazon.com/sftp/pricing/ for more details.