Discuss

Setup AWS hosting with Docker

On this page

You can easily create a new server for your hosting on Amazon AWS with just a few clicks. In order to use Docker with AWS you need to have an AWS account.

Creating an AWS account

If you don't have an AWS account yet, go to https://aws.amazon.com/ and create one:

Screenshot_2|690x392

Follow the steps and setup your account.

When you are done setting up your account, log into the AWS Console:

Screenshot_3|690x392

Setting up user and access

Once you have your AWS account ready you need to setup an user and access keys for it. Open https://console.aws.amazon.com/ and you will see the AWS console with all the services available. In the search bar type iam and select the IAM service which appears in the search results:

Screenshot_7|690x392

Select Users in the left menu:

Screenshot_8|690x392

Then select Add user:

Screenshot_9|690x392

Add a username and select the Access type for your user. We need to select the Programmatic access option here, as it provides the access keys we need for our user. Click Next, when you are done:

Screenshot_10|690x392

Select Attach existing policies directly:

Screenshot_11|690x392

Filter the policies by typing ec2 and select AmazonEC2FullAccess, click Next:

Screenshot_62|690x361

And select Create user:

Screenshot_63|690x361

You can see your user has been created. Make sure to copy the Access key ID and the Secret access key for your user, as they will be needed for the Docker machine:

Screenshot_65|690x361

Creating Amazon AWS Docker Machine

Now as you created your user, let’s setup an Amazon AWS Docker machine.

Create a new target

Click the Project Setting button:

Screenshot_66|690x363

Select Targets and click the Add New Target button:

Screenshot_67|690x363

Add a name for your target:

Screenshot_68|690x363

Open the Hosting dropdown and select Docker:

Screenshot_69|690x363

Then set the Connection to Remote:

Screenshot_70|690x363

And click the Manage button:

Screenshot_71|690x363

Create a New Docker Machine

Click the Add New Docker Machine button:

Screenshot_72|690x363

Add a name for it:

Screenshot_73|690x363

Open the Provider menu and select Amazon AWS:

Screenshot_74|690x363

Then enter the Access and Secret Keys for your Amazon AWS user, which we already created:

Screenshot_75|690x363

Setup the Region, Size and OS options for your machine and click the Create button:

Screenshot_80|690x363

You will see the Success message, when the machine has been created for you:

Screenshot_81|690x363

Then select this machine from the dropdown:

Screenshot_82|690x363

Click the Save and close the project settings:

Screenshot_83|690x363

And you are done, just select the new Amazon AWS target from the Targets dropdown:

Screenshot_84|690x363

And you are ready to deploy:

Screenshot_85|690x363

Just open your site in a browser to preview it!