Secure Cloud Environment: 6 Essential Fixes and Mistakes
A secure cloud environment is mostly about undoing defaults. A new Google Cloud project is built for getting started quickly: broad roles are one click away, the default network lets SSH in from anywhere, and every VM can have a public address. This guide walks through the changes that matter most, in the order I would make them on a new project, using Google Cloud as the example. It is based on Google Cloud's official documentation (IAM, VPC, firewall and IAP pages on docs.cloud.google.com, read on 18 November 2026), not on a hands-on test in a cloud account, and every command below is copied from those pages.

Roles come first because in a secure cloud environment everything else depends on who can change it. The earlier version of this post recommended least privilege and then, in its own example, granted roles/editor. That example is the best place to start.
Contents
Step 1: replace basic roles in a secure cloud environment
Owner, Editor and Viewer are what Google calls basic roles, and the IAM roles overview is blunt about them: "Basic roles include thousands of permissions across all Google Cloud services. In production environments, do not grant basic roles unless there is no alternative." The same page says to grant "the most limited predefined roles or custom roles that meet your needs", and, for staging or test environments, to prefer the newer Admin, Writer and Reader roles, which also support IAM Conditions.
So the old example,
gcloud projects add-iam-policy-binding [PROJECT_ID] \
--member="user:[EMAIL_ADDRESS]" \
--role="roles/editor"
is the command to look for and remove, not the one to copy. If a person or service already has a basic role, the Use IAM securely checklist suggests role recommendations to find the narrower roles to grant instead, and the Policy Simulator to check that the change will not break access. Run the simulator first; removing Editor from a deployment pipeline on a Friday afternoon is how outages start.
Also keep in mind a rule from the same checklist: allow policies on child resources inherit from their parents. A role granted on a folder or the project applies to everything below it, so grant at the lowest level that works.
Step 2: one service account per service
A secure cloud environment also needs separate identities for software. Workloads use service accounts, and the checklist says: "Treat each component of your application as a separate trust boundary." If several services need different permissions, create a separate service account for each and grant only what that one needs. A shared "app" account with wide rights means one compromised component gets all of them.
Keys are the other risk. The docs describe rotation as four steps: create a new key, switch applications to it, disable the old key, and delete it once you are sure it is no longer used. They also warn not to confuse encryption keys, which protect data, with service account keys, which give access. A service account key in a Git repository is a password to your project.
Step 3: build the network on purpose
Every new project starts with a default network unless you disable it. According to the VPC networks page, that default is an auto mode network, with one subnet created automatically in each region and pre-populated firewall rules. The same page says custom mode VPC networks "are more flexible and are better suited to production". That is also what the old post's example created:
gcloud compute networks create my-vpc \
--subnet-mode=custom
With a custom network, the secure cloud environment gets only the subnets you need, in ranges you chose, which matters later when you connect the network to an office or another cloud over VPN and the ranges must not overlap.
Step 4: remove SSH and RDP from the internet
The default network's firewall rules are listed in the VPC firewall rules documentation. Three of them open the door wide, all with priority 65534 and source 0.0.0.0/0:
default-allow-ssh: allow tcp:22default-allow-rdp: allow tcp:3389default-allow-icmp: allow icmp
A fourth, default-allow-internal, allows all traffic from 10.128.0.0/9, the range of the auto mode subnets. The page notes these rules "can be deleted or modified as necessary". In a secure cloud environment, delete the SSH and RDP ones and use Identity-Aware Proxy (IAP) TCP forwarding for admin access instead.
Step 5: admin access through IAP
The IAP TCP forwarding guide says the firewall must allow ingress from 35.235.240.0/20, "This range contains all IP addresses that IAP uses for TCP forwarding" (for IPv6 VMs, 2600:2d00:1:7::/64). Its SSH rule:
gcloud compute firewall-rules create allow-ssh-ingress-from-iap \
--direction=INGRESS \
--action=allow \
--rules=tcp:22 \
--source-ranges=35.235.240.0/20
For a secure cloud environment, the guide adds the warning that ties this together: "The default-allow-ssh and default-allow-rdp default rules allow SSH and RDP connections from all IP addresses, not only from IAP." Creating the IAP rule does nothing for security until the default rules are gone.
Who may tunnel is controlled by IAM, not by the firewall. The guide lists the IAP-secured Tunnel User role (roles/iap.tunnelResourceAccessor) for TCP forwarding. To connect, gcloud compute ssh uses IAP automatically for a VM without an external IP; the --tunnel-through-iap flag forces it even when the VM has one. With that in place, most VMs need no public address at all.
Step 6: encryption, logging and the rest
A secure cloud environment also needs encryption, monitoring and backups, which the old post listed. They matter, but they come after the steps above, because they do not help if anyone can log in as Editor or reach port 22 from the internet. When you get there, use the provider's own documentation for each service, and keep two habits from this guide: test every change before production, and record which defaults you changed and why.
Secure cloud environment checklist
- Find every basic role (Owner, Editor, Viewer) and replace it with predefined or custom roles, checked with the Policy Simulator.
- Grant at the lowest resource level; in a secure cloud environment, inheritance is the silent way rights spread.
- Give each service its own service account and rotate any keys.
- Use a custom mode VPC for production.
- Delete
default-allow-sshanddefault-allow-rdp; allow only the IAP range. - Grant
roles/iap.tunnelResourceAccessorto admins and remove external IPs where possible.
The same secure cloud environment ideas apply on AWS with different names. For working on AWS from the terminal, see master AWS in your terminal, and for a container service in private subnets behind a load balancer, deploying Flask to AWS Fargate.
Comments
Post a Comment