Amazon AWS

Amazon AWS is perfect for the Enterprise customers who wish to have a very robust platform with high availability. It is used and trusted by some of the largest companies in the world to serve as their Cloud infrastructure.

Prerequisites

We assume in this that you already have a MongoDB instance available. We recommend services provided by MongoDB Cloud or Compose which integrates into AWS cloud. A Redis server can be provided by AWS ElasticCache service or through Compose.

Next you will find the S3 bucket that Elastic Beanstalk created within your AWS Account. This typically looks like the following when you go to S3 section of your AWS Account.

If this bucket does not exist, then you may need to create a default Elastic Beanstalk deployment so that it will automatically create this bucket and configure it for Elastic Beanstalk use.

Once you get this bucket created, you will now need to add your formio.dockercfg to this bucket and take note of the name of this bucket to configure the Dockerrun.aws.json

Elastic Beanstalk

Now that you have the authentication file in place, you are ready to create your Elastic Beanstalk deployment.

Create your Docker deployment file - Within your local machine, create a new file called Dockerrun.aws.json with the contents as follows. The Authentication Bucket and Key should be the bucket name and the file name you uploaded to that bucket with your docker hub configuration.

If your database is high availability (like from Mongo Cloud or Compose), then this needs to be set.

1

ADMIN_EMAIL

The default administrator email

admin@example.com

ADMIN_PASS

The default administrator password

[YOUR PASSWORD]

DB_SECRET

The database encryption secret

[DB SECRET]

JWT_SECRET

The secret password for JWT token encryption.

[TOKEN SECRET]

PROTOCOL

Only use this if you are not behind https (for test environments only)

http

When you are done, you can now press the Create Environment button at the bottom of the page to build your environment.

This will now create a new Environment within AWS for your deployment. You are now ready to attach your Domains to the deployment.

Domain Routing (Route 53)

Now that your Environment is up and running, the next task is to attach a Domain to the Elastic Beanstalk deployment. If you configured the Elastic Beanstalk deployment to use High Availability, then it will have created some Elastic Load Balancers in front of the deployment which you can link the DNS records against.

To get started, we will click on Route 53

Next, you will need to created a Hosted Zone

You will now provide your domain name and then press Create

Next, you will create a new Record Set and then provide the following record.

*.yourdomain.com

Type - A Record

Alias - Yes

Then select the Elastic Load Balancer as the target.

Now press Create

When you are done, your routes should look something like the following.

Now, you set your domain Nameservers to point to the ones provided by Route 53. Once the domains evaluate, then you should be able to see the deployed API within that domain.