Cloud Endpoints Quickstart
Cloud Endpoints are centrally managed endpoints in the cloud that can be used to route traffic to agent endpoints.
This guide will walk you through setting up a Cloud Endpoint quickly.
Prerequisites
Whether you're using the API or the Dashboard, to create Cloud Endpoints you'll need:
- A reserved domain or TCP address
- If you're using the API, you'll need an ngrok API key
Dashboard
You can create Cloud Endpoints using the ngrok dashboard.
- In the menu on the left side, navigate to Universal Gateway > Endpoints.
- Select the + New button, then select Cloud Endpoint in the modal that appears.
- Select a binding. For this example, you can choose public.
- Enter the URL you want to use for your endpoint. For example, for a public Cloud Endpoint that serves traffic over HTTPS you might use
https://my-app.ngrok.dev
. - Select Create Cloud Endpoint.
After completing these steps, you'll be taken to a page where you can manage your Cloud Endpoint's Traffic Policy. Visit the URL you specified to ensure that it's online. You should see a default landing page that says "This is your new Cloud Endpoint!"
API
You can also create Cloud Endpoints programmatically via the ngrok API. This example uses the ngrok CLI to interact with the API, but you can use any HTTP client of your choice.
Before you start, you'll need your ngrok API Key.
1 - Create your Traffic Policy
First, create a policy.yml
on your local machine. The policy you'll create for this example will:
- Forward incoming HTTP requests to an Internal Endpoint (https://default.internal)
- If your Internal Endpoint is not reachable, it will fall back to a custom response
Paste the following into your policy.yml
file:
Loading…
2 - Create your Cloud Endpoint
Now you can create your Cloud Endpoint by running the following command, replacing {YOUR_API_KEY}
and https://my-example-app.ngrok.dev
with your API key and desired URL:
Loading…
3 - Visit your endpoint
Your endpoint should be successfully online. Verify this by visiting the URL you assigned to it. You should see the content available at the Internal Endpoint you're forwarding traffic to.
If your Internal Endpoint is down, you should see the custom response you configured in your policy, which in thise case reads Agent offline!
.
Next Steps
- Check out the guide on load balancing with Cloud Endpoints to learn how to distribute traffic across multiple internal endpoints.
- See the Cloud Endpoints overview to learn about use cases, how they compare to Agent Endpoints, and more.