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.
We assume in this that you already have an account with Amazon AWS. Once you create an account, you will then be ready to create your Enterprise deployment.
Before we start our deployment, we will first need to create a Database to store all of our Forms and Submissions within our Form.io deployment. We will use the fantastic DocumentDB to serve as our central database.
To get this setup, please follow the following instructions.
Within your AWS Console, type DocumentDB and click on the link that says Amazon DocumentDB
Now that you are within the Amazon DocumentDB Clusters section, click on the link that says Create
In the next section, provide a Master username and a secure password, then press Create Cluster
Now that our DocumentDB cluster is created, we will now click on the cluster link, and then copy the connection string. It should look like the following.
Next, we will want to change this connection string to be a standard connection string. We do this by first adding our database name to the end of
:27017/. We can pick any name here, but for this example, lets use formio
Now, we will want to replace
<insertYourPassword>with the password you chose above when you created the cluster.
Finally, we will want to add
ssl=trueto the end of the url to indicate that we have a database connection over SSL.
Make sure to copy this connection string for use later.
The next item we will setup will be ElasticCache. This is only needed if you are also deploying the PDF Server within your deployment since it is utilized to store and retrieve temporary authentication tokens used for downloading PDFs. Follow the instructions below to setup this service.
Within the AWS Search bar, type Elastic and then click on the link that says ElastiCache
- If you see an introduction screen, make sure to click on the link that says Get Started Now
- Under the Create Page, make sure to provide the following required configurations.
- Cluster Engine: Redis
- The values of the other options can be determined by you, but here is just an example.
- Name: formio-redis
- Description: A Redis service for the Form.io platform.
- Engine Version Compatibility: Pick the latest version
- Port: 6379
- Node Type: cache.r5.large
- Number of Replicas: 2
- When you are done, click on the Create button.
- When the Redis server is done creating, you can then click on the Cluster Name, and then copy the value of the Primary Endpoint as shown below.
Now that we have our database and redis configured, we will be using Elastic Beanstalk to manage our docker deployments.
- Within the AWS Home page, type Elastic Beanstalk into the search and click on the link provided.
Once you are within the Elastic Beanstalk main page, you will want to click on the link that says Create New Application
In the next screen, provide a name and a description for your deployment. Then click Create
Now, you will need to create an Environment. To do this, click on the link within the main page.
For the environment tier, select Web server environment
- For this next section, we will provide our own specifics for our environment. We will want to provide the following.
- Application Name: Pick your own
- Environment Name: Pick your own, but it is typical to have prod, dev, stage, etc in the name
- Domain: Pick your own
- Description: provide your own.
- Platform: Docker
Application Code: For this, we will want to upload a ZIP provided @ https://github.com/formio/aws-formio-deployment/raw/master/latest.zip. After you click Upload button, we will select this file as follows.
Next click on the button that says Configure More Options
In the next page, click on Modify link within the Software section.
We will now need to provide the following environment variables within the environment variables section.
Setting Description Example MONGO The MongoDB connection string to connect to your remote database. This is the value we copied before. mongodb://formio:email@example.com:27017/formio?ssl=true MONGO_SA The URL to the MongoDB SA public certificate file. Copy this value as is. https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem REDIS_ADDR The domain for the Redis server we copied from the ElastiCache section. formio-redis.h7i6uh.ng.0001.use1.cache.amazonaws.com REDIS_PORT The port for the redis server we copied earlier. 6379 LICENSE The license for your deployment. You will get this when you upgrade a project to Enterprise. <—YOUR LICENSE—> PORTAL_SECRET A secure secret that you will pick that is secure to establish a secure portal connection. CHANGEME DB_SECRET A secure secret that you will pick that is used to encrypt the project settings. CHANGEME JWT_SECRET A secure secret that you will pick that is used to establish secure JWT tokens. CHANGEME
These settings will look like the following.
- Now press the Save Button to save your environment settings.
Next we will configure the Instances settings
Within the instance settings, we need to ensure that the Security Groups enabled are the same as those we established for both the DocumentDB as well as the ElastiCache. By default, this is going to be the default security group. Select this and press Save button.
- Now press the Save Button to save your environment settings.
- 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.
- 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.