---
title: "Cloud security architecture: a layered design for VPS apps · CloudSat"
description: "Design cloud security in layers: shared responsibility, identity, network edge, admin access, hosts, apps, data and detection, with a reference layout."
url: https://cloudsat.io/learn/layered-security-for-cloud-servers
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Security](https://cloudsat.io/learn/topic/server-security)

# Cloud security architecture: a layered design for VPS apps

Design cloud security in layers: shared responsibility, identity, network edge, admin access, hosts, apps, data and detection, with a reference layout.

CloudSat team November 18, 2026 6 min read

"Security architecture" sounds like something drawn by a large company's consultants, but every deployment with more than one server already has one. The only question is whether it was designed or simply happened. The goal is defense in depth: no single mistake, whether a leaked password, a forgotten open port or an unpatched plugin, should expose everything. This guide lays out the layers for a typical small production app running on VPS servers, gives a reference layout you can copy, and ends with the questions that reveal weak spots in what you already run.

## Start with the shared responsibility line

On infrastructure as a service, the provider and you split the work at the virtual machine:

| Layer | Provider | You |
| --- | --- | --- |
| Data centers, power, hardware | Yes |  |
| Hypervisor and network edge | Yes |  |
| Volumetric flood filtering | Usually | Application-level abuse |
| Operating system and patches |  | Yes |
| Firewall rules, open ports | Provides the tools | Writes the rules |
| Accounts, keys, tokens | Secures the console | Manages who has what |
| Applications and data |  | Yes |
| Backups and recovery | Snapshot tools | The plan, the copies, the tests |

On CloudSat, the KVM hypervisor and network-level [DDoS filtering](https://cloudsat.io/ddos-protection) sit on the provider side; everything from the operating system up is yours. Platform and software services move the line upward, but the account, the data and the access decisions always stay with you.

## The layers and what each one stops

| Layer | Main threats | Core controls | Typical tools |
| --- | --- | --- | --- |
| Identity | Stolen credentials, misuse of access | SSO, MFA, least privilege, scoped tokens | Keycloak or authentik, a password manager |
| Network edge | Scans, brute force, exposed services | Provider firewall, as few public ports as possible | Cloud firewall rules |
| Admin access | Attacks on SSH and RDP | VPN or bastion host, keys or certificates | WireGuard, NetBird, Headscale |
| Host | Unpatched packages, weak defaults | Automatic updates, hardened baseline, host firewall | unattended-upgrades, Lynis, nftables |
| Application | Injection, broken authentication, bots | Reverse proxy, TLS, WAF, rate limits, dependency scanning | Caddy or nginx, SafeLine, OSV-Scanner |
| Data | Theft, loss, ransomware | Encryption, off-site backups, retention | restic, LUKS |
| Detection and response | Intruders going unnoticed | Central logs, alerts, a written response plan | Wazuh, Uptime Kuma, Grafana with Loki |

Each layer assumes the one in front of it can fail. The host firewall exists for the day someone opens the wrong port in the cloud firewall. Backups exist for the day every other layer fails.

## A reference layout for a three-tier app

Three servers, one public entry point, and a private tunnel for everything else:

```text
             Internet
                │  TCP 80, 443
                ▼
        ┌──────────────┐   reverse proxy, TLS, WAF
        │   proxy-01   │   public: 80, 443
        └──────┬───────┘
               │  WireGuard 10.10.0.0/24
        ┌──────▼───────┐
        │    app-01    │   application, listens on 10.10.0.2 only
        └──────┬───────┘
               │  WireGuard
        ┌──────▼───────┐
        │    db-01     │   PostgreSQL on 10.10.0.3 only
        └──────────────┘
  Admins reach all three over WireGuard; SSH listens on tunnel addresses
```

The rules that make it work:

1. **Only the proxy accepts public web traffic.** In the provider firewall, the app and database servers allow nothing from the internet except WireGuard's UDP port from the other two servers and from admin addresses.
2. **Services bind to tunnel addresses.** The application listens on `10.10.0.2:8080`, and PostgreSQL uses `listen_addresses = '10.10.0.3'`. Even a firewall mistake does not expose them on the public interface.
3. **Administration goes through the tunnel.** SSH answers only on WireGuard addresses, so the public internet never sees it. Keep the provider's out-of-band console as the way back if the tunnel breaks.
4. **Backups leave the building.** A separate machine pulls encrypted backups from `db-01`, with credentials production cannot use to delete them.

A WireGuard peer configuration on `app-01` looks like this:

```ini
[Interface]
Address = 10.10.0.2/24
ListenPort = 51820
PrivateKey = <app-01 private key>

[Peer]
PublicKey = <proxy-01 public key>
Endpoint = 203.0.113.11:51820
AllowedIPs = 10.10.0.1/32

[Peer]
PublicKey = <db-01 public key>
Endpoint = 203.0.113.13:51820
AllowedIPs = 10.10.0.3/32
```

`AllowedIPs` doubles as an access list: each peer may only send from its own tunnel address.

## Build every host the same way

Configuration drift is how a careful design decays. Give every server the same baseline: automatic security updates, key-only SSH, a default-deny host firewall, time synchronization, logs shipped to another machine, and nothing installed that the role does not need. Apply it from code, with cloud-init, Ansible or a shell script under version control, so a rebuild takes minutes and a compromised server can be replaced rather than cleaned. CloudSat's deploy wizard accepts a [startup script](https://cloudsat.io/docs/startup-scripts), which is a simple way to apply that baseline to each new server. Audit the result against a reference such as the CIS Benchmarks, and run `sudo lynis audit system` for a quick list of weak settings.

## Make detection a layer of its own

Prevention fails quietly; detection is what turns a silent intrusion into a short one. Run log collection on a separate machine reachable over the tunnel, for example a Wazuh manager or Grafana with Loki, so an intruder on one server cannot erase the evidence. Collect authentication and `sudo` logs, web server access logs, firewall drops and application errors. Then alert on a short list of events that should never happen unannounced: a new SSH key or user, a new listening port, a spike in failed logins, a backup job that did not finish. Finally, check availability from outside your own infrastructure, so the monitor does not go down with the thing it monitors.

## Assess what you already run

Five questions expose most gaps. Answer them in writing:

1. **What is reachable from the internet?** Scan your own public addresses from outside and compare the result with what you intended.
2. **Who can log in where?** List every account, SSH key and API token for each system. Anything without an owner is a finding.
3. **What can one compromised server reach?** If the web server falls, can it read the database directly, reach the backups or call your cloud API with write access?
4. **How fast can you restore?** Time a real restore of the database and the application to a new server.
5. **Would you notice?** Name the alert that would fire if someone added an SSH key to a server tonight.

If you want a broader frame, NIST's Cybersecurity Framework 2.0 groups the same work into six functions: govern, identify, protect, detect, respond and recover. The five questions above touch identify, protect, detect and recover. Govern means writing down who owns each decision, and respond means having an [incident response plan](https://cloudsat.io/learn/cloud-incident-response-plan) before you need one.

## Patterns to remove first

- A database on a public address, protected only by its password.
- One SSH key or one admin account shared by the whole team.
- Admin panels such as phpMyAdmin, Portainer or Grafana open to the internet.
- Backups on the same server, or reachable with the same credentials as production.
- Flat trust, where every server can reach every other server on every port.

## FAQ

### Do I need a VPN if I already have a firewall?

A VPN shrinks your administrative attack surface to one well-audited port. Source-restricted firewall rules work too, but they get harder to maintain as people work from changing addresses.

### Is zero trust relevant for a small team?

Its practical core is: authenticate every request, grant the least privilege, and never trust traffic just because it comes from inside your network. That applies at any size, and the layout above follows it.

### Does any of this matter for a single server?

Yes. The layers still apply: a provider firewall, a host firewall, hardened services, an application behind a proxy, encrypted off-site backups and alerts. Only the network segmentation needs more than one machine.

**Run it on CloudSat.** Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. [See plans](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Security](https://cloudsat.io/learn/topic/server-security)

- [Protect cloud server data: encryption, backups and retention](https://cloudsat.io/learn/protect-data-on-cloud-servers): Security Protect cloud server data: encryption, backups and retention 6 min read
- [Hardware vs software firewalls, and where cloud firewalls fit](https://cloudsat.io/learn/hardware-software-cloud-firewalls): Security Hardware vs software firewalls, and where cloud firewalls fit 6 min read
- [Cloud IAM for small teams: least privilege, MFA and tokens](https://cloudsat.io/learn/cloud-iam-least-privilege-checklist): Security Cloud IAM for small teams: least privilege, MFA and tokens 6 min read
- [What is cloud security? A working program for small teams](https://cloudsat.io/learn/cloud-security-program-for-small-teams): Security What is cloud security? A working program for small teams 7 min read
