As I am currently evaluating the three bigger cloud providers (Amazon AWS, Microsoft Azure and Google Cloud Platform) I came up with the idea to test how easy it would be to get Docker running on those providers. In this tutorial I deal with Amazon “AWS”, as I like them most out of the three mentioned.
On 23th of April 2014, Amazon added Docker support for their AWS Elastic Beanstalk, but this time, we will just focus on the EC2, not only due to cost issues.
The idea is to stay with the servers that are available at no charge (The so called “free tier”, which can run 24/7 for free within the first year). Of course, you can go for any other server instance as you like and need.
First we will set-up a small server instance on the EC2 service, followed by the docker set-up and the deployment of one example docker container.
Get the server instance up
- Login to your AWS Management Console
- On the next screen, you can get an overview of the available instances. They are categorized in instance families, like „computing optimized“ or „memory optimized“. Just choose which one you need for your Docker host. In my case I went for the free tier eligible micro instance „t1.micro“ that is powerful enough to test web servers or even a non-powerful Tomcat instance. To configure in detail, just take the „Next: Configure Instance Details“ button here.
- At the storage page, you can add up to30GB taken from your general purpose SSD to the machine. – Just remove the „delete on termination“, to persist the machine, even after termination. In this case, I added 10GB of space here. Be aware, that these 10 GB actually means that you have 30 IOPS. Those are the maximum input-output operations per second and they scale with the size of your disc. So this will be enough for a small webserver, but of course not for an production system.
- I left the tagging of the instance out. You can add some tags with values here, but they are not needed in this case of setting up a Docker server.
- Step 6 – „Configure Security Group“ will need our attention. What I do here is to configure the ports 80 and 443 (for HTTP and HTTPS) to the outer world, and all other traffic only to my specific IP. This can of course be changed later on. Depending on the desired purpose you can add other specific ports here or setting a tougher security policy. I will for instance log in to the AWS console and change the security rule to my current IP address as often I need it. So, feel free to set it up as you need it and keep this settings in mind when launching Docker containers later on.
- You will be asked about the way you would like to connect to your machine. If this is the first time, setting a machine up, you have to choose “Create a new Key Pair” here. Give it a speaking name and download the key pair to your computer to a save place and make a backup of them. You will need it every time to connect to your server instance. In my case, the key file is named MyDockerInstance.pem. I have those files stored in a encrypted container file created by Truecrypt. You might secure this file.