Setup AWS hosting with Docker

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:

Follow the steps and setup your account.

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

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:

Select Users in the left menu:

Then select Add user:

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:

Select Attach existing policies directly:

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

And select Create user:

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:

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:

Select Targets and click the Add New Target button:

Add a name for your target:

Open the Hosting dropdown and select Docker:

Then set the Connection to Remote:

And click the Manage button:

Create a New Docker Machine

Click the Add New Docker Machine button:

Add a name for it:

Open the Provider menu and select Amazon AWS:

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

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

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

Then select this machine from the dropdown:

Click the Save and close the project settings:

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

And you are ready to deploy:

Just open your site in a browser to preview it!

2 Likes

Under Project Settings when I try this after picking Docker and Remote, there’s only Digital Ocean in the dropdown as that 1 and only option to pick. There’s no AWS or Hyper-V? Was trying to figure out how to use Docker on Azure earlier but gave up when it seemed like Digital Ocean was the only supported one. Tried scrolling down etc, that’s the only option there is.

Well AWS support for Docker is coming in Wappler 3.2.0 - just update :slight_smile:

5 posts were split to a new topic: Getting the Wappler 3.2 update

@Teodor - does this setup the Elastic IP address by default, so we can simply point our DNS to the IP in Wappler created by this?

This is great!

Has this been tested with Docker on Beanstalk?

Generally most scaling apps don’t run on a single container on ec2 because they generally require EBS storage.

General architecture is Beanstalk for app scaling and deployment, RDS database and s3 storage (s3 we now have the beginnings of :+1:). You can run Docker container on Beanstalk but having the database included is problematic.

Do you see an issue with the current wappler docker build deployed on beanstalk?

Hey, it is really easy to set up the elastic IP! Once you have your instance up and running you can allocated an EIP and point it at the instance ID.

Now this assumes that your ec2 security group / inbound and outbound rules are set correctly.

Then you can point your DNS to the EIP.

1 Like

Make sure you have performed the last two steps of the tutorial above, selecting the target and hitting the deploy button on the toolbar below.

A post was split to a new topic: AWS docker deploy and IP

How does the database part work? As with a DO i can create the database from the Target… how is this different in AWS setup as I cannot see the “database” in the screenshorts above.

A post was split to a new topic: Error creating AWS docker machine