Deploying botpress on AWS

I did a video a couple of weeks ago. This video was about deploying botpress on an HTTPS server using DigitalOcean and google domain name. I do want to create a blog post to accompany this video. Instead of using the same cloud provider, I will use another one. In this blog post, I will use AWS as my cloud provider to route all my connections from the domain name that I brought on the Google registry domain. (Same pattern as in the video). You can find the video below if you prefer.

Deploying botpress with digital oceans

AWS

AWS doesn't have a global nameserver for redirecting traffic from a domain name to a server. To make sure all the traffic that goes to learnbotpress.com I need to use route53 to create a DNS nameserver. In the console of AWS, I will go in the route53 service and click create new Hosted zones. This new hosted zone will be used for my learnbotpress.com domain name. In the route53 service, I will create new hosted zones.

After the creation of the route53 service, You will have 4 DNS nameservers. You will need to use those servers on your google domain registry (or another domain registry)

Redirect traffic to your domain name

On the google domain name registry website, you want to redirect the traffic.

  1. Go to the DNS menu
  2. Click Custom Name Servers
  3. Manage Name servers

It's time to add the nameserver you got from the route53 service into the custom name servers.

You need to tell Google Domains to use those name servers. I don't have the image for this one sorry :(. But I do remember you need to do it. From the google domain name website, it says that it can take up to 30 minutes to update the DNS registry. To check if your DNS propagation has been successful you can use some website. I used the website called whatsmydns.

Security group in AWS

Once the DNS propagation is done. You need to modify the security group for your EC2. The security group is like UFW for the server. I will let the ACL (access control list) be open to everyone (ACL is for the VPC).

In the security group, you need to open the inbound traffic (HTTPS, HTTP, and SSH) before running the docker-compose.

To open the Inbound traffic for the security group, you can go on your EC2 instance.

  • In the tab security
  • Click on the security group associated with your ec2 instance.
  • In the security group section, you can click on the inbound traffic tab and edit your inbound traffic.
  • Make sure to add IPV6 and IPV4 in the inbound traffic for your EC2 instance.

You don’t need to modify the ACL inbound and outbound traffic. Unless you have done specific modifications to your ACL. By default, it should allow all the traffic.

Start EC2 instance

In the AWS console, you can search for the EC2 (Elastics Cloud Computing) service. This service is used to start a server on AWS.

  1. Search for the EC2 Service
  2. Click on "instance" on the left panel
  3. Launch the instance


  1. In the search bar, search for ubuntu 20.04
  2. Click on the instance

Botpress needs 4 GB of ram and 64 GB of free space to run correctly. Find a size that matches those criteria.

Select a Security group or create a new one if you don't have any. We are gonna do some modifications to this security group in a couple of minutes. After this, you will need to select a private key. This private key will be use as the key for the ssh connection.

Update route53 with the IP address of your EC2

Your domain name is known by the DNS, it knows where to find it. But your domain needs a server behind it. The EC2 installation is done. The IP address of the EC2 will be used in route53 service.

If you go in the route53 service in AWS.

  1. Select Hosted Zone
  2. The domain name you want to route your server

Inside the route53 create a new record.

  1. For the first record, the record name should be empty
  2. The record type should be A
  3. Value is the IP address of your EC2

And the second record to add is www.


  1. For the second record, the record name will be www
  2. Record Type is A
  3. Value is the IP address of your EC2

At the end, you should have something like this.

  • Two A records that match the IP address of the EC2 instance
  • Four NS record that is linked in the domain name provider
  • One SAO

Start Botpress

The first thing to do is to go in your EC2 instance. I will use SSH for this. You should have a private key that is assigned to your EC2 server.

$ ssh -i "Botpress-daehli.pem" [email protected]

You can find that information if you go on your instance, and click on the connect button.

Inside your server you can start by updating the apt-get registry

$ sudo apt-get update

After you need to install docker

$ sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg$ echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null$ sudo apt-get update$ sudo apt-get install docker-ce docker-ce-cli containerd.io

And the last piece of the puzzle is the docker-compose

$ sudo apt install docker-compose

After the installation of docker. Clone the botpress project on your server.

$ git clone https://github.com/botpress/botpress.git$ cd botpress/example/docker-compose$ sed -i ‘s/$PLACE_HOLDER_DOMAIN_NAME/learnbotpress.com’ docker-compose-community-nginx-https.yml$ sed -i ‘s/$PLACE_HOLDER_DOMAIN_NAME/learnbotpress.com’ nginx/user_conf.d

Start the botpress project

$ docker-compose -f docker-compose-community-nginx-https.yaml up -d

In the docker-compose file, the Nginx service will create an encrypted key. This key is used to enable HTTPS connection between the user browser and your server. It can take a moment to create this key for the let's encrypt. Once the let’s encrypt is done you can navigate to your website (in this case www.learnbotpress.com learnbotpress.com).

Conclusion

I hope it was a helpful blog post. You have learned How to spin up a server and use a domain name. You can start deploying your bot on different channels. Most of the external channels (Messenger, Slack) need to have a valid domain name with an HTTPS connection.

Happy chatbot coding

Related Articles

Industry
August 11, 2020

What is Conversational AI and How Does it Work?

What is conversational AI? Discover from Botpress how conversational AI works and learn more about AI-based conversational tools and how they work with natural language processing to help human users through AI chatbots, virtual customer assistants and virtual employee assistants.

Industry
October 21, 2020

AI Now Is Like Computers in the 80s

This link is an interview with Steve Jobs in 1981 along with a news report on computers...

Industry
October 29, 2020

How Does a Chatbot Work?

Here is a comprehensive view of the key components of a chatbot and how information flows. Learn how a chatbot works

© Botpress 2023