Console Login

The Hybrid Cloud Reality: Why Your Data Needs a Norwegian Passport

The Hybrid Cloud Reality: Why Your Data Needs a Norwegian Passport

Let’s cut through the marketing noise. Everyone is shouting "Go Cloud," but if you are running a business in Norway, shoving everything into AWS-Ireland or Frankfurt is not a strategy; it’s a liability. I recently audited a setup for a customized e-commerce platform targeting the Nordic market. Their latency was averaging 45ms to the database, and their legal team was sweating bullets over the recent collapse of Safe Harbor and the shaky ground of the new EU-US Privacy Shield.

The solution wasn't to abandon the public cloud, but to stop treating it as the only place where infrastructure exists. We moved the core database and customer PII (Personally Identifiable Information) to local VPS Norway instances, while keeping the stateless frontend autoscaling groups on public cloud infrastructure. The result? Latency dropped to 3ms for local users, and the Datatilsynet (Norwegian Data Protection Authority) compliance became a checkbox rather than a headache.

Here is how we architected a compliant, high-performance hybrid stack using tools available right now in late 2016.

The Architecture: "Core & Edge" Split

In this model, CoolVDS acts as the "Core"—hosting your stateful data on high-performance NVMe storage within Norwegian jurisdiction. The public cloud acts as the "Edge," handling bursty HTTP traffic.

The stack:

  • Core (CoolVDS): MySQL 5.7 (Master), Redis (Session Store), VPN Gateway.
  • Edge (Public Cloud): Nginx (Reverse Proxy/Load Balancer), PHP 7.0 FPM nodes, VPN Client.
  • Glue: OpenVPN tunnels and Terraform v0.7 for orchestration.

Step 1: The Tunnel (Networking)

Public clouds and private VPS providers don't share a VPC. You need a bridge. We standardized on OpenVPN because IPsec configuration can be temperamental across different vendor firewalls. Do not use default encryption.

Here is the server config (/etc/openvpn/server.conf) deployed on the CoolVDS instance. Note the cipher AES-256-CBC which is mandatory for security in 2016.

port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 10.10.0.0 255.255.255.0" # Route to local private network
keepalive 10 120
tls-auth ta.key 0
cipher AES-256-CBC
auth SHA256
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3

Once the tunnel is up, your public cloud web nodes can talk to the CoolVDS database over a private IP (e.g., 10.8.0.1). This traffic is encrypted and traverses the internet securely.

Step 2: Data Persistence & NVMe Performance

Latency kills conversion rates. If your database is on a standard SSD (or heaven forbid, EBS Magnetic) in Frankfurt, and your user is in Trondheim, the round trip time (RTT) adds up on complex SQL queries.

CoolVDS offers local peering at NIX (Norwegian Internet Exchange). But the hardware matters more. We utilize NVMe storage. In our benchmarks using fio, NVMe drives on KVM virtualization delivered 4x the IOPS of standard SATA SSDs found in most cloud instances.

Here is the fio command we used to validate the storage throughput before migration:

fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randwrite --ramp_time=4
Pro Tip: When configuring MySQL 5.7 on NVMe, the default innodb_io_capacity is too low. It assumes spinning disks. Crank it up to utilize the drive's potential.

Update your my.cnf:

[mysqld]
# Basic settings
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql

# NVMe Optimizations
innodb_buffer_pool_size = 6G # Adjust based on RAM (70-80%)
innodb_log_file_size = 1G
innodb_flush_log_at_trx_commit = 1 # ACID compliance is key
innodb_flush_method = O_DIRECT
innodb_io_capacity = 2000 # Boost this for NVMe
innodb_io_capacity_max = 4000

Step 3: Infrastructure as Code with Terraform

Managing hybrid environments manually is a disaster waiting to happen. While AWS has CloudFormation, it doesn't talk to your external VPS. This is where HashiCorp's Terraform shines. We are currently using version 0.7.11.

You can provision the public cloud resources and then use the remote-exec provisioner to bootstrap the CoolVDS connection. While CoolVDS integration requires standard SSH provisioning (since a native Terraform provider isn't universal yet), we can abstract it.

resource "aws_instance" "web_node" {
  ami           = "ami-f90a4880" # Ubuntu 16.04 LTS
  instance_type = "t2.medium"

  provisioner "remote-exec" {
    inline = [
      "sudo apt-get update",
      "sudo apt-get install -y openvpn",
      "echo '${file("client.conf")}' > /etc/openvpn/client.conf",
      "sudo service openvpn start"
    ]
  }
}

This script ensures that any new node spun up in the public cloud instantly connects back to the mothership in Oslo.

The Compliance & Latency Verdict

Why go through this trouble? Two reasons.

  1. Legal Safety: With the GDPR regulation looming (adopted this April, enforceable in 2018), data sovereignty is becoming critical. Keeping the database physically in Norway on CoolVDS simplifies your legal stance regarding "Third Country" data transfers.
  2. Speed: Routing local traffic to local servers is physics. We saw Time to First Byte (TTFB) drop from 200ms to 45ms when serving cached content from local nodes.

Don't be a slave to a single vendor's ecosystem. A managed hosting approach where you control the core data, combined with cloud scalability, is the pragmatic choice for 2017 and beyond. If you need low latency and ddos protection that understands the Nordic threat landscape, a generic US giant won't save you.

Stop accepting 40ms latency as "good enough." Deploy a KVM instance on CoolVDS today, run your own benchmarks, and see what true raw I/O looks like.