Aug 15 2023
Jun 28 2023
When launching our Edge Compute product 10 months ago, we began a journey of making it incredibly easy to deploy applications in edge locations around the world. One of the biggest challenges with using Edge Compute, especially for services that need to talk with each other, has been the lack of discoverability of running instances.
Without using our API or writing your own software, there was no easy way to find the IPs of other instances running in workloads. While we could write code to retrieve IPs from the API, we knew there had to be an easier way.
When looking at possible solutions, our main goal was to offer a solution that developers could leverage without any special or custom tooling. We also wanted a solution that would provide a similar experience as other tooling developers may be accustomed to.
DNS is a tool that many developers have worked with previously and also works out of the box for a significant amount of existing tooling. DNS has also been popularized as a Service Discovery solution by other tooling like Consul and Kubernetes.
It was a natural fit that DNS could be used for Service Discovery within Edge Compute and would open the doors for integrations with existing tools and services.
The idea for DNS Discovery was born!
DNS supports multiple query types that makes it a simple yet powerful solution for enabling Service Discovery. For instance, an A record allows a user to resolve a single hostname into one or more IP addresses and service records (SRVs) that can be used as Service Discovery to discover the ports and hostname that services are running on.
DNS Discovery is an internal DNS service that runs within each of our Edge Compute locations that gives workloads the ability to discover information about itself, other instances running within a location, other instances in the workload, or even instances in other workloads. Instances running in your stack can make DNS queries for any other workload instance running in your stack.
Note: DNS Discovery is only available to workload instances at this time.
Here are some use cases we believe DNS Discovery will be valuable for when creating and configuring workloads:
DNS Discovery works off the deterministic names provided to workload instances and the unique DNS-compatible names given to workloads and stacks.
The slug for your stack can be viewed under the stacks section of the control portal. Similarly, for workloads, we automatically generate a slug value based on the name provided to the workload. These are viewable in the workloads overview section in the portal.
Using this data, we can construct DNS hostnames that allow users to resolve the IPs of instances.
For example, assume we have a workload that has a slug of my-database-server and a stack with a slug of my-default-stack-123667. When running a workload in Edge Compute, an instance will be able to make a DNS query for my-database-server.my-default-stack-123667.edgeengine.internal and get a list of Virtual Private Cloud (VPC) IPs—the private IPs that instances used for internal communication—for all instances running in that workload. Similarly, if we have a workload instance with the name my-database-server-us-jfk-0 we could make a DNS query for my-database-server-us-jfk-0.my-default-stack-123667.edgeengine.internal and resolve the VPC IP of the workload instance.
Let’s take a closer look at some of the DNS queries that can be made with DNS Discovery.
Note: You can also resolve the Public IPs of instances by using compute.edgeengine.io instead of edgeengine.internal.
Look up the VPC IPs for all instances in a workload.
[workload-slug].[stack-slug].edgeengine.internal
Look up the VPC IPs for all the instances in a target of a workload.
[target-name].[workload-slug].[stack-slug].edgeengine.internal
Look up the VPC IP of the requesting workload instance.
self.metadata.edgeengine.internal
Look up the VPC IP of a workload instance.
[instance-name].[stack-slug].edgeengine.internal
Refer to the reference section on DNS Discovery for a full list of supported DNS queries and the IPs they resolve.
We are extremely excited to bring a DNS-based Service Discovery solution to Edge Compute. DNS Discovery unlocks the potential to seamlessly configure applications running in Edge Compute with no custom tooling or solutions.
Be on the lookout for more features being added as we continue this journey of making deployments at the edge as easy as possible.
Have a feature request or feedback? Share it with us here!