Bindings make it easy to connect services together. They enable components of large-scale, multi-tier applications to interconnect in a virtual cloud deployment that can span hybrid clouds. Recently, ElasticBox made bindings even more powerful. Now at deploy time, services can automatically detect dependencies — with the help of binding tags.
Binding tags boost complex deployments in a couple of ways:
- Dynamic bindings. Tagged bindings discover instance connectivity dynamically. They serve as an auto-discovery mechanism where instances with binding tags can automatically connect to other instances that match those tags.
- One to many bindings. Bindings can connect one or many services together, again, using tags. Previously, every connection required an exclusive binding. But that’s no longer necessary.
We’ll use an example to see how bindings work. Let’s suppose that an Nginx loadbalancer needs to detect freshly launched Node.js instances and automatically add them to its loadbalancing pool. We do three things to achieve this scenario. The first two are part of box automation:
- Define binding variables
- Configure bindings for your application
- Tag bindings for instance connectivity
Step 1. Define binding variables
Step 2. Configure bindings for your application
But to actually establish binding connectivity to a remote service, we need to configure the binding for your application or service. In this example, to allow connectivity to the Node.js application, we generate a binding connection string in the configure script of the Nginx loadbalancer box.
In this case, the configure script runs the ElasticBox config command to process the variables of a file, which contains the binding connection string.
Here, ‘services’ is the binding variable that gets information on each instance fulfilling the binding criteria. In our example, the criteria is to bind to all Node.js application instances.
Within the connection string, each element points to values of the Node.js application box variables, such as the port. IP addresses are default system variables in ElasticBox. Besides IP addresses, bindings provide lots of helpful data about remote services. You can pretty much query ports or any other variables defined in box automation through bindings.
Step 3. Tag bindings for instance connectivity
Services connect to each other using binding tags at deploy time. Here, when deploying the Nginx loadbalancer, we specify that it can bind to Node.js application instances containing these tags: production, nodejsapp.
And then we launch our Node.js application instances with those same tags.
Now if we go to the Nginx instance and do a reconfigure operation, we see that Nginx is able to automatically detect and connect to the application instances over the binding.
We saw how binding tags simplify complex multi-tier deployments for one or many connections. Want to give binding tags a try for your own deployments? Follow the three steps covered in this post to get things going. Use bindings the next time you need to connect application services or manage their connections across hybrid clouds. Benefit from service auto-discovery and dynamic connectivity through bindings.