How to Configure Cosmos Port

Published
Length
3 min read

Luis Felipe Dias

All posts

Your cosmos port setting controls how apps and users send traffic to your database. You set it up by picking a connection mode and opening only needed firewall ports. Every database client needs a clear network path to read and write data. Cloud databases support two main traffic modes for client apps. One mode sends all requests over standard web ports. The other mode speaks straight to backend data nodes over a range of ports. Picking the right mode keeps your network simple and safe. Your ne

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Your cosmos port setting controls how apps and users send traffic to your database. You set it up by picking a connection mode and opening only needed firewall ports.

Every database client needs a clear network path to read and write data. Cloud databases support two main traffic modes for client apps. One mode sends all requests over standard web ports. The other mode speaks straight to backend data nodes over a range of ports. Picking the right mode keeps your network simple and safe. Your network team must match firewall rules to the mode you pick.

How cosmos port modes work for apps and teams

The first option is a standard mode that uses a single HTTPS port. This mode works well when your app runs behind strict firewall rules. It needs fewer open ports on your local network. It also works well for developers who query data from their laptops. Traffic stays easy to route through your cloud network.

The second option is direct mode, which talks straight to backend storage nodes. This mode uses a wide range of TCP ports for fast data transfers. High-volume apps use this mode to cut down on network delay. Still, opening many ports on a firewall increases your risk surface. You should restrict these port ranges to trusted virtual networks only.

Good defaults start with blocking all public traffic to the database. Use private network links so traffic stays inside your cloud network. Grant each app its own role with narrow read or write permissions. Never share master keys across different teams or apps. Rotate your keys often to limit risk if a key leaks.

How to check network rules and close session gaps

After you set up your firewall rules, test the path from your app host. Check your cloud network logs to see which ports pass traffic. Make sure blocked ports drop packets as expected. Review your database logs to see which users and apps log in. Look for failed login attempts or requests from unknown network addresses.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Network port rules only control how traffic reaches the database server. Once a user or app logs in, the firewall does not inspect queries. A valid role with wide permissions can still read every item in a container. Static port rules cannot stop a user from pulling sensitive fields. For example, queries can return raw emails, phone numbers, or card numbers.

Shared database keys make this problem even worse for security teams. If three engineers use the same connection string, logs show one shared identity. You cannot tell who ran a destructive delete query during an outage. Static firewall settings also keeps the session active all day and night. To fix this, teams need controls that work at the query level. Masking can rewrite matched fields like national IDs in query results.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

What happens if my firewall blocks the direct port range?

Your database client will fail to connect or time out during requests. You can switch the client to standard HTTPS mode to use one port.

Does each database API use the same cosmos port?

No, each API style uses its own specific port for client traffic. Check your cloud provider docs for the port that matches your API.

No, private links only keep traffic off the public internet. You still need local firewall rules to limit which hosts reach those ports.

The query runs. The emails stay hidden.