Cloud architecture for developers personal projects.
In this post i'm going to describe my personal preference for cloud host for personal projects and learning. As a rule, I try to use industry leading tools and not dev only products.
In the architecture diagram above, I described how I used AWS services to host my project. This example match for most of the scenarios I had.
The first scenario I want to talk about is how to setup a personal docker hosting, to run and manage dockers on an ec2 machine on AWS. In my solution, I wanted to get flexibility and management console so I can run and stop container easily, also I didn't want to get out of docker eco-system, so the options I had are docker swarm or docker-machine. I choose docker-machine because its super simple to set up and in the development process I don't need to use complex tools to deploy and manage the docker containers.
The setup is super simple with the docker-machine CLI, checkout this link for more details.
docker-machine create --driver amazonec2
After you finish to set up the machine, you can configure a portainer container on this instance and to configure it to listen to port 80. Also, you need to make sure port 80 is open on the instance security group - don't forget to backup the new created ssh key. Now, to get easy access, if you have a domain on AWS Route53, I added a record to point to the instance ip, (for advance security i will set up openssl and grant access only on https), now you can use this url to access the portainer management console and manage dockers, you can also pull dockers from docker hub. I suggest you to practice and push docker containers to docker hub.
To summarise the first option, this can handle basically everything. After i finished the set up I used spotinst to create a cheaper clone and replace the old instance with a new reserved instance (you can wait with this if you are in the free tier) I will also suggest to set a budget alarm to notify you when you reach a certain price. With this option you can use all kinds of applications when they are packed as a docker container.
The second scenario, is to use serverless and per use services to host projects with low volume very cheaply (most of the time they are free), for example, the AWS lambda service to host function and pay per invocation. In the diagram above I demonstrate how I hosted the devresources.site project on AWS, I'm storing the client assets on the S3 and serve it with Cloudfront CDN. The server logic is using AWS lambda and accessed with API Gateway.
In conclusion, don't be afraid to use cloud services. Using this kind of tools is the best way to learn about cloud and development and to give others access to your projects, make sure to do this responsibly - cloud services can be costly if not managed correctly.