Endpoints: A Direct Connection to the Cloud

Endpoints: A Direct Connection to the Cloud

The platform’s Endpoints feature allows for TCP/UDP port mapping via the Shared Load Balancer, making it easier for instances to work with external tools and services. With raw TCP or UDP protocols, this feature enables direct connections to particular nodes without needing a public IP address.

Endpoints can be utilized for many different things, such as managing databases remotely, hosting multiple project copies on a single instance, deploying apps straight from IDEs (for IIS), and more.

Here, we will learn how to use the endpoints on the platform and explore some interesting use cases that you may experiment with.

Endpoints Managing

The environment Settings menu, accessed by clicking on the corresponding button for a particular environment, contains the list of endpoints.

Endpoint

After the tab has been launched, select the “Endpoints” menu option. You can now start organizing your list of mappings.

Adding Endpoints

Click the “Add” button in the toolbar at the top to add a new endpoint, then fill out the form that displays the required data.

Fill out the form

  • Instance – Choose the node where you want to configure the endpoint (only nodes within the selected environment are shown).
  • Name – Enter a title for the new endpoint or select from the provided options (a list is available below).
  • Private port – Specify the local node port to map (this is automatically filled if you selected a predefined Name).
  • Protocol – Choose TCP or UDP.

The Public port and Access URL will be configured automatically by the platform.

Click “Add” when you are done.

Added endpoint

The real values for the Public port and Access URL are shown in this section. You can quickly copy a specific string by clicking on it and using these parameters for your actions.

Edit/Remove Endpoint

Any existing endpoint can be readily edited or deleted if it is no longer required. Choose the desired connection from the list of endpoints, then click the Edit (or double-click on the line) or Remove (or click the button) in the tools pane above to accomplish this.

Edit/remove endpoint

Depending on the option you choose, you’ll encounter the following:

When you select “Edit,” the Add Endpoint form and the Edit Endpoint form will appear. This is where you can change any setting that was previously discussed, with the exception of choosing a new Node, which is superfluous because you can just add a new endpoint to the chosen instance.

Edit endpoint

After making the necessary changes, simply click the “Apply” button located at the bottom of the frame.

For “Remove,” a special pop-up window will appear where you will need to confirm your decision.

Remove edited endpoint

Immediately after confirming, the respective endpoint will be deleted from the list.

Endpoints Use-Cases

Once the required mappings are established, you can use them for a variety of purposes. We’ll go over a few typical use cases for endpoints below to get you started.

For example, let’s look at a system that has a MySQL database and an Apache application server (you can make a setup like this by following this guide):

Use cases

Now, let’s learn how to use endpoints for:

Database Management

You may easily access your database instance remotely by using endpoints, which eliminates the need for extra parameters like a Public IP. Let’s look at two straightforward methods for carrying out this function: using an external database client and the embedded OS terminal.

Connection via Terminal

The standard approach uses the inbuilt terminal on your local computer, which saves additional installations and configurations and provides sufficient functionality for a simple connection setup. Just run just one command:


mysql -h {host} -P {port} -u {user} -p

Connection via terminal

Here are the details for the command:

{host} – the Access URL of the endpoint without the port suffix (e.g., node30292-env-1425869.us.accuweb.cloud.com in our case)
{port} – the assigned public port number (e.g., 3306 in this example)
{user} – the database user name (which was sent to you via email during the environment creation; by default, it’s ‘root’ for all new MySQL servers)

After executing the command, you’ll be prompted to enter the appropriate password for the database user (this password can also be found in the email mentioned earlier) to access your database.

That’s it! Now you can begin working with your database by running the necessary SQL queries.

Connection via Local Client

Use a desktop database client if you require more sophisticated features or would rather manage your database data more conveniently. These clients come with a variety of capabilities to make your work easier and user-friendly graphical interfaces.

For instance, using the established endpoint, one of the most widely used database management programs, MySQL Workbench, can enable remote access to your database.

1. Launch MySQL Workbench and click on the “New Connection” button.

MySQL Workbench dashboard

2. In the “Setup New Connection” window, enter the following information at the top:

  • Connection Name: Choose a name for your connection (e.g., AccuWeb-db).
  • Connection Method: Select the “Standard (TCP/IP)” option.

Setup new connection

Next, enter the required database details in the “Parameters” tab below:

  • Hostname: Use the endpoint URL without the port number at the end (e.g., node5551-env-142569.us.accuweb.cloud.com).
  • Port: Enter the endpoint’s public port (e.g., port 3306 assigned during setup).
  • Username: Use the admin DB username provided via email during environment creation (usually defaults to “root” for new MySQL servers).
  • Password: Optionally, click “Store in Vault..” to save your password (found in the email) or leave blank to enter it each time.

Click “OK” to save the configuration.

3. To establish the connection, double-click on the newly formed link and enter your password in the popup that displays (if it has not yet been stored).

Store password

If you want to avoid entering your password by hand every time you access your database, you can choose to store it in the keychain. Press “OK” to proceed.

4. You will have established a successful connection to your database in a minute.

Successful Connection

Excellent! Now you can begin managing your data using all the features offered by the comprehensive management client.

Similarly, you can connect to any other database server within the platform or perform tasks like backing up and restoring your data using dump files.

Multiple Development Stages at a Single App Server

Apart from performing fundamental database management functions, endpoints offer the ability to incorporate an array of practical and captivating solutions for additional servers. We’ll look at one such useful possibility made possible by this feature below: how to use an application server as your production and development environments on the same machine at the same time (using our environment’s Apache instance as an example).

1. Open the preferred unused private port on your Apache server and map the endpoint to it.

Private port

2. Now, deploy your application twice to different contexts (for example, production and development).

Deploy environment

3. Next, configure Apache itself by clicking the “Config” button next to the server and opening its main configuration file (located at `conf > httpd.conf`).

httpd.conf

4. Scroll down and insert the following line into the list of listened ports:


Listen 0.0.0.0:{port}

Listened ports

Here, replace the `{port}` parameter with the private port number you specified when adding the endpoint (in our case, we chose port 81).

5. Next, navigate to the end of the file and create a duplicate of the VirtualHost section, ensuring to specify the same port number used in the previous step (in our case, port 81) within its heading.

Create duplicate Virtual host

Next, make sure that both virtual hosts’ DocumentRoot locations are updated to point to their respective projects (use “dev” for the custom section below and “prod” for the default).

6. In order to make the changes take effect, save your work and restart the Apache server.

Save and restart

7. Using the “Open in browser” button or, if one was additionally attached to your app, entering the external custom domain, you can now visit your “prod” project as usual. Use the Access URL provided by the endpoint to gain access to the “dev” version.

Open in browser

With two access points to your two projects, you may now work on one copy of each project and do any testing or development you want without affecting the other. Furthermore, they can be switched with only a few clicks if needed.

Watch this space for other real-world applications of endpoints in the coming future.