β NEVER create flat compartment structure (no hierarchy)
```
BAD - Flat compartments:
tenancy/
ββ app1-dev
ββ app1-test
ββ app1-prod
ββ app2-dev
ββ app2-test
ββ app2-prod
Problems:
- No isolation boundaries
- Cannot apply policies to all dev environments
- Cannot delegate administration
- Cost reports are unstructured
```
```
GOOD - Hierarchical compartments:
tenancy/
ββ Network/
β ββ Hub
β ββ Spokes
ββ Security/
β ββ Vault
β ββ Logging
ββ Workloads/
β ββ App1/
β β ββ Dev
β β ββ Test
β β ββ Prod
β ββ App2/
β ββ Dev
β ββ Test
β ββ Prod
ββ Shared-Services/
ββ Identity
ββ Monitoring
```
Why critical: Hierarchical structure enables policy inheritance, delegation, and logical cost segregation. Flat structure requires duplicate policies and makes governance impossible at scale.
β NEVER use default VCN CIDR (10.0.0.0/16) everywhere
```
BAD - Same CIDR in all environments:
Dev VCN: 10.0.0.0/16
Test VCN: 10.0.0.0/16 # Cannot peer with Dev!
Prod VCN: 10.0.0.0/16 # Cannot peer with Dev or Test!
Problems:
- VCN peering impossible (overlapping CIDRs)
- Cannot create multi-environment connectivity
- VPN/FastConnect integration blocked
- Requires complete rebuild to fix
```
```
GOOD - Non-overlapping CIDR allocation:
Dev VCN: 10.10.0.0/16
Test VCN: 10.20.0.0/16
Prod VCN: 10.30.0.0/16
Hub VCN: 10.0.0.0/16 (shared services)
Enables:
- VCN peering for cross-environment access
- Hub-spoke topology for centralized egress
- On-premises connectivity via FastConnect
```
Cost impact: VCN CIDR is IMMUTABLE. Wrong CIDR = complete rebuild = downtime + migration costs.
β NEVER skip Security Zones in production compartments
```bash
# BAD - no security zone enforcement
oci iam compartment create \
--compartment-id $PARENT_ID \
--name "Prod" \
--description "Production workloads"
# Result: No guardrails, resources can violate security policies
# GOOD - security zone enabled
# 1. Create security zone recipe
oci cloud-guard security-zone-recipe create \
--compartment-id $TENANCY_ID \
--display-name "CIS-Prod-Recipe" \
--security-policies "[\"deny-public-ip\", \"deny-public-bucket\"]"
# 2. Create security zone for prod compartment
oci cloud-guard security-zone create \
--compartment-id $PROD_COMPARTMENT_ID \
--display-name "Prod-Security-Zone" \
--security-zone-recipe-id $RECIPE_ID
# Enforces: No public IPs, no public buckets, encryption required
```
Why critical: Security Zones prevent violations BEFORE resource creation. Without them, auditing finds violations AFTER compromise. Cost of breach: $100k-$10M+.
β NEVER mix dev and prod resources in same compartment
```
BAD - shared compartment:
App1/
ββ vm-dev-1 (development instance)
ββ vm-prod-1 (production instance)
ββ db-prod (CRITICAL DATABASE)
Problems:
- Developers with dev access can accidentally delete prod DB
- Cannot set different backup policies
- Cost reports mix dev and prod spending
- Compliance violations (SOC2, ISO27001)
```
```
GOOD - separate compartments:
App1/
ββ Dev/
β ββ vm-dev-1 (developers have full access)
ββ Test/
β ββ vm-test-1 (QA has access)
ββ Prod/
ββ vm-prod-1 (only SRE access)
ββ db-prod (only DBA access)
Enables:
- Least privilege per environment
- Separate budgets and alerts
- Independent backup policies
- Compliance audit trails
```
Risk: Production outage from dev team mistake. Happened at 47% of surveyed enterprises in 2023.
β NEVER use root compartment for workload resources
```
BAD - resources in root:
tenancy (root)/
ββ vcn-1 (WRONG - in root)
ββ instance-1 (WRONG - in root)
ββ database-1 (WRONG - in root)
Problems:
- Cannot delegate administration
- Root policies affect all resources
- Cannot isolate blast radius
- Violates CIS OCI Foundations Benchmark
```
```
GOOD - workloads in child compartments:
tenancy (root)/
ββ only IAM resources (users, groups, dynamic groups)
ββ Workloads/
ββ App1/
ββ vcn-1 (proper isolation)
ββ instance-1
ββ database-1
Root compartment usage:
- Identity resources only (users, groups, policies)
- Top-level compartments
- Nothing else
```
Why critical: Root compartment is for tenancy-wide IAM. Resources in root bypass governance.
β NEVER skip tagging strategy (cost allocation nightmare)
```
BAD - no tags:
Resource created with no tags
Cost report shows: "oci.compute.instance: $5,234/month"
Question: Which team? Which project? Which environment?
Answer: Unknown - requires manual investigation
Result: Cannot chargeback costs, cannot optimize
```
```
GOOD - defined tag namespace + mandatory tags:
# 1. Create tag namespace
oci iam tag-namespace create \
--compartment-id $TENANCY_ID \
--name "Organization" \
--description "Organization-wide tags"
# 2. Create mandatory tags
oci iam tag create \
--tag-namespace-id $NAMESPACE_ID \
--name "CostCenter" \
--description "Cost center for chargeback" \
--is-retired false
oci iam tag create \
--tag-namespace-id $NAMESPACE_ID \
--name "Environment" \
--description "Dev/Test/Prod" \
--is-retired false
oci iam tag create \
--tag-namespace-id $NAMESPACE_ID \
--name "Owner" \
--description "Team or service owner" \
--is-retired false
# 3. Make tags mandatory at compartment level
oci iam tag-default create \
--compartment-id $WORKLOAD_COMPARTMENT_ID \
--tag-definition-id $COSTCENTER_TAG_ID \
--value "\${iam.principal.name}"
Cost report now shows:
- CostCenter: Engineering ($3,200)
- CostCenter: Marketing ($2,034)
- Environment: Prod ($4,100)
- Environment: Dev ($1,134)
```
Cost impact: Without tags, cost optimization is guesswork. With tags, precision chargeback and 30-50% cost reduction via waste identification.
β NEVER use single-region landing zone for production
```
BAD - single region:
All resources in us-ashburn-1
RTO: Hours-days (rebuild in new region)
RPO: Last backup (data loss)
Problems:
- No disaster recovery
- Region outage = complete downtime
- Violates SLA requirements
- Insurance/compliance issues
```
```
GOOD - multi-region architecture:
Primary: us-ashburn-1
DR: us-phoenix-1
- Autonomous Data Guard (standby)
- Traffic Manager (DNS failover)
- Object Storage replication
- Compartment structure mirrored
RTO: 15 minutes (automated failover)
RPO: Near-zero (Data Guard sync)
```
Cost: Multi-region adds 60-100% infrastructure cost. Cost of regional outage: $500k-$50M depending on SLA.
β NEVER allow internet gateway in DMZ without egress firewall
```
BAD - direct internet gateway:
DMZ Subnet β Internet Gateway β Internet
No egress filtering, all outbound traffic allowed
Problems:
- Data exfiltration possible
- Command & control connections unblocked
- Compliance violations (PCI-DSS, HIPAA)
```
```
GOOD - egress control via NAT or firewall:
Option 1: Service Gateway + NAT Gateway
DMZ Subnet β NAT Gateway β Internet
- Egress only, no inbound
- All traffic logged
- Can use Network Firewall for DPI
Option 2: Hub-spoke with centralized firewall
Spoke β DRG β Hub VCN β Network Firewall β Internet
- All egress goes through hub
- Firewall policies enforce allow-list
- Complete visibility and control
```
Security impact: Uncontrolled egress is #3 cause of data breaches (Verizon DBIR 2023).