Cloud Core — Compute, IAM and VPC Networking

Choose a cloud compute model, grant access with least privilege, and design a private network boundary using AWS as the main example, with Azure and Google Cloud equivalents.

Est. 45 min Updated Suggest a fix
// Part 01 — The mental model

A Cloud App Is Compute, Identity and Network Boundaries

Imagine a delivery-tracking API used by customers in Mumbai and Hyderabad. It needs somewhere to run, permission to read only the data it needs, and a network path that lets customers reach the API without exposing the database. Those are three separate design questions: compute, identity, and networking.

A cloud provider supplies data centres and managed services through an account or subscription. You select a region, create resources there, and connect them with policies and network rules. Your cloud account is not a single computer; it is a boundary for billing, identity, quotas, and governance. Start by drawing the request path and marking which component is public, which is private, and which identity acts at each hop.

QuestionAWS exampleWhat to decide
Where does the code run?EC2, ECS, LambdaHow much control, scaling, and operational work do we need?
Who may call a service?IAM role and policyWhich identity needs which action on which resource?
Which network path is allowed?VPC, subnet, security groupWhich sources and destinations need to communicate?
Where should it run?AWS Region such as MumbaiUser latency, data location, service availability, and recovery plan
💡 Note
Cloud does not remove operations. It gives you APIs and managed building blocks. You still own access control, safe configuration, data protection, and the application's reliability.
// Part 02 — Compute choices

Match the Compute Model to the Workload

A virtual machine (VM) gives you an operating system and broad control. You patch it, configure its runtime, and decide how to scale it. Containers package an application and its dependencies; a managed container service schedules those containers while you still decide how they are deployed. Serverless functions run a handler in response to events or requests; the provider manages the underlying hosts, while you manage code, permissions, timeouts, and limits.

ModelGood fitYou still operate
Virtual machineLegacy app, custom OS needs, or a long-running processPatching, capacity, process health, and scaling policy
Managed containersWeb API or worker already packaged as an imageImage security, task sizing, health checks, rollout, and service config
Serverless functionShort event-driven task with variable demandHandler correctness, permissions, retries, timeout, and observability

For a small order-status service, a container behind a managed load balancer may be an easy step from Docker Compose. A scheduled cleanup may fit a function. A VM may be appropriate when the application depends on a specific OS setup. Do not pick a service because it sounds modern: estimate its operating burden, traffic pattern, recovery needs, and team familiarity first.

🎯 Pro Tip
Choose the simplest model that meets the workload's needs. A managed service can reduce host maintenance, but it does not automatically make the application secure or highly available.
// Part 03 — Regions and networks

Place Resources, Then Draw the Network

A region is a provider's geographic deployment area. AWS has a Mumbai region identified as ap-south-1 and a Hyderabad region identified as ap-south-2. Region choice affects latency, service availability, data placement obligations, and recovery design. Verify that every required service is available in your chosen region before committing to it; do not assume two regions have identical offerings.

A Virtual Private Cloud (VPC) is a logically isolated network in AWS. A subnet is an address range within a VPC, associated with a particular availability zone. A public subnet has a route to an internet gateway; a private subnet does not expose a route that makes its workloads directly reachable from the public internet. A security group is a stateful traffic filter attached to network interfaces or resources. It allows explicitly configured inbound and outbound traffic; it is not a replacement for application authentication.

Cloud conceptAWSMicrosoft AzureGoogle Cloud
Identity and permissionsIAM users, roles, policiesMicrosoft Entra identities and Azure role-based access controlCloud Identity principals and IAM roles/policies
Virtual networkVPCVirtual Network (VNet)Virtual Private Cloud network
Network segmentSubnetSubnetSubnet
Traffic ruleSecurity group; network ACLNetwork Security GroupVPC firewall rule
Virtual machineAmazon EC2Azure Virtual MachinesCompute Engine
Serverless functionAWS LambdaAzure FunctionsCloud Run functions

These names are conceptual equivalents, not proof that each provider has identical defaults or behavior. Read the provider's documentation before translating a security design. In a common three-tier layout, an internet-facing load balancer sits at the edge, application containers run in private subnets, and the data store has no public endpoint. The app can connect to the data store on its required port; the internet cannot.

// Part 04 — Identity

Use Roles and Policies, Not Shared Administrator Keys

An IAM user represents a person or long-lived identity; a role is an identity that a trusted person, workload, or service can assume for a limited purpose. Prefer individual human identities through your organization's identity system, and give an application a role rather than copying a person's access key into its environment. A policy describes allowed or denied actions on resources, sometimes with conditions. The principle of least privilege means granting only the actions and resources needed for a specific job, then reviewing that access as the job changes.

Here is a deliberately narrow policy shape for an application that reads one named object from one named S3 bucket. Replace the example account and bucket values in a controlled environment; do not attach this sample as a broad administrator policy. A real application may need additional actions, which should be identified from its behavior and tested in a non-production account.

read-one-object-policy.json
json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ReadOneApplicationObject",
      "Effect": "Allow",
      "Action": ["s3:GetObject"],
      "Resource": "arn:aws:s3:::example-orders-data/config/runtime.json"
    }
  ]
}

The policy grants one action on one object path. It does not allow listing the bucket, changing data, or reading other objects. In AWS, an identity policy is only one part of the authorization decision: the identity must also be allowed to act by the applicable trust relationship, organization controls, resource policies, and other boundaries. A role trust policy answers who may assume this role; its permissions policy answers what the role may do.

⚠️ Important
Never commit cloud credentials, private keys, or production tokens. Use your provider's workload identity mechanism where possible, short-lived credentials, and a protected secrets store for values that cannot be federated.
// Part 05 — Traffic flow

Allow Only the Network Paths the App Uses

For a web API, write down each required connection before opening a port. A typical path is browser → HTTPS load balancer → application → database. The application does not need to accept inbound traffic directly from every internet address if a load balancer is its only caller. The database should accept connections only from the application's security group or equivalent identity-aware network boundary, on the one database port it actually uses.

  1. Create an address plan for the VPC and its subnets that does not overlap networks you need to connect later.
  2. Place public entry points separately from application and data workloads.
  3. Allow inbound HTTPS at the public entry point; do not make a database publicly reachable for convenience.
  4. Allow the app-to-data connection only from the application security group and required port.
  5. Review outbound access too; add a controlled egress path when workloads need external services.
  6. Test both the intended path and a denied path, then record the expected behavior.

Security groups are stateful: return traffic for an allowed connection is handled as part of that connection. Network ACLs operate at the subnet boundary and are stateless, so return traffic needs its own rule. Start with security groups for workload-level boundaries and add subnet-level controls when the network design calls for them. Exact defaults and rule semantics differ by provider.

Before changing a rule, inspect the current configuration with a read-only query. This inventory command summarizes security-group ingress ports in the configured region; review the full details in the AWS console or documentation before deciding whether any rule is needed.

inspect-security-groups.sh
bash
aws ec2 describe-security-groups   --query 'SecurityGroups[].{Id:GroupId,Name:GroupName,Ingress:IpPermissions[].{Protocol:IpProtocol,From:FromPort,To:ToPort}}'   --output table
// Part 06 — Hands-on

Inspect an AWS Region Without Creating Resources

The safest first cloud exercise is read-only. With AWS CLI configured for a training account, inspect the identity associated with the current credentials and ask for the region configuration. These commands do not create or change cloud resources. If you do not have an account, read them as examples and use your provider's equivalent console or documentation instead.

inspect-cloud-context.sh
bash
# Confirm which AWS identity your current credentials represent.
aws sts get-caller-identity

# Show the configured default region for this CLI profile.
aws configure get region

# List VPCs in the configured region; this is a read-only inventory call.
aws ec2 describe-vpcs \
  --query 'Vpcs[].{VpcId:VpcId,Cidr:CidrBlock,State:State}' \
  --output table

# Explicitly select a region for a read-only availability-zone query.
aws ec2 describe-availability-zones \
  --region ap-south-1 \
  --query 'AvailabilityZones[].{Name:ZoneName,State:State}' \
  --output table

The identity call is a useful guard before any later change: verify the account and role are the ones you intended. Region names can be selected explicitly, as in the final command. Do not copy commands that create resources into a production account without a reviewed plan, budget controls, and a cleanup plan.

📌 Real World Example
A practical design review for an Indian commerce app might compare Mumbai and Hyderabad for user latency and recovery. The right answer depends on the system's data-residency obligations, service availability, dependencies, and tested recovery objectives—not on geography alone.
// Part 07 — Production thinking

Design for Access, Availability and Cost Together

A secure network can still be unavailable if it has a single failure point. Consider whether the service should span more than one availability zone, how health checks remove an unhealthy instance, and what happens if a region is unavailable. A multi-region design adds operational and data-consistency complexity; it is a deliberate recovery choice, not a checkbox. Measure the business impact and rehearse the recovery process.

Cloud cost follows the resources and data paths you operate. VMs incur charges while provisioned, and data transfer, managed services, storage, and logs can all contribute. Use budgets and alerts, tag resources with owner and purpose, shut down lab resources when finished, and inspect bills regularly. Avoid claiming a design is free or assigning a fixed monthly price without checking current provider pricing and actual usage.

Review areaQuestions to ask
IdentityCan each person and workload use a separate, auditable identity? Can unused permissions be removed?
NetworkIs every public endpoint intentional? Can the database be reached only by its app?
ReliabilityWhat fails if one instance, zone, or region is unavailable? Has recovery been tested?
OperationsWho patches, observes, and owns the service? Are logs and change history available?
CostWhich resources and data transfers drive cost? Is there an owner, budget, and cleanup policy?
// Part 08 — Pitfalls

Common Mistakes

Choosing the most powerful VM before understanding the workload

Why: Extra capacity feels like safety but increases cost and can hide scaling problems.

Fix: Start with demand, latency, and availability requirements; size conservatively and measure.

Giving every developer administrator access

Why: Broad access makes early setup easy but magnifies mistakes and credential theft.

Fix: Use individual identities, task-specific roles, least-privilege policies, and periodic reviews.

Putting the database in a public subnet with a strong password

Why: Authentication does not remove the large attack surface of public reachability.

Fix: Keep data private and allow only the app boundary to connect on the required port.

Assuming an AWS rule translates exactly to Azure or Google Cloud

Why: Provider concepts have similar names but can differ in defaults and evaluation.

Fix: Map the intent, then verify the target provider’s documented behavior and test it.

// Part 09 — Practice

Sketch a Safe Order-Status Service

Practice

A cloud design with a private data path

  1. Draw a request path for a customer-facing order-status API and mark each public and private component.
  2. Choose VM, managed container, or serverless compute for the API and explain the operational trade-off.
  3. Write an IAM permission requirement in plain language: principal, action, resource, and any useful condition.
  4. Describe the inbound and outbound traffic rules for the load balancer, app, and database.
  5. Compare Mumbai and Hyderabad for a hypothetical Indian service; list the facts you would verify before choosing.

Hint: Start with the three identities and paths: customer to entry point, entry point to app, and app to data. Avoid starting from provider product names.

🎯 Key Takeaways

  • ✓Cloud architecture combines compute, identity, and network boundaries; reason about each separately and then trace the request path.
  • ✓VMs, managed containers, and serverless functions trade control for operational work in different ways.
  • ✓IAM roles are preferable for workloads; grant narrowly scoped actions and resources, and distinguish role trust from permissions.
  • ✓Keep data private, expose only intentional entry points, and allow workload-to-workload traffic on required paths only.
  • ✓AWS Mumbai and Hyderabad are ap-south-1 and ap-south-2; verify service availability and recovery requirements before selecting a region.
  • ✓Azure and Google Cloud have comparable concepts, but their behavior and defaults must be checked in their own documentation.

Next

What comes next

How requests reach your app: DNS records, TLS certificates, load balancers, and configuring Nginx as a reverse proxy.

Lesson 07 · Networking for DevOps — DNS, Load Balancers and Nginx →

HELP US IMPROVE

How was this lesson?

Your note is shared with the Chaduvuko team for review. Please don’t include personal or sensitive information.

Choose your feedback

Spotted a mistake or something unclear? Suggest a fix on GitHub or email us. Select the text first and it is quoted for you.

Share

Discussion

0

Have a better approach? Found something outdated? Share it — your knowledge helps everyone learning here.

Continue with GitHub
Loading...