Series: Setting up Oracle Cloud VM - III

This is a continuation from: [[002 Creating new OCI VCN]]

✅ Step 3: Create and Set Up the Traefik VM

This VM will act as your gateway, managing all incoming traffic via Traefik and routing it to other VMs/services.


🎯 Goal:

Provision a public VM with:

  • 1 OCPU + 6GB RAM
  • Ubuntu 22.04 aarch64
  • Public IP
  • Attached to the public-subnet
  • Docker + Traefik installed
  • Source/destination check disabled

🛠️ 3.1: Launch the Instance

  1. Go to: ☰ Compute → Instances
  2. Click Create Instance

Fill in:

FieldValue
Nametraefik-gateway
Compartmenthomelab
ImageUbuntu 22.04 aarch64
ShapeVM.Standard.A1.Flex  1 OCPU, 6 GB RAM
Boot volume size50 GB (default is fine)
SSH KeyPaste your public SSH key (or generate a new one)
Network:
- VCNhomelab-vcn
- Subnetpublic-subnet
- Assign Public IP✅ Yes (very important)
- Hostnametraefik (optional)
☑️ You can leave Advanced Options and Management as default.

Change VM Shape:

Canonical Ubuntu 22.04 Minimal aarch64

🔍 Why This Image?

CriteriaReason
 aarch64 (ARM)Required for VM.Standard.A1.Flex, Oracle's ARM-based free-tier compute
 Ubuntu 22.04Stable, LTS release supported till 2027 — widely supported by Docker, Traefik, Keycloak, Supabase, etc.
 MinimalFewer preinstalled packages = faster boot, lower RAM usage — ideal for 6GB RAM limit
 Canonical OfficialDirect from Ubuntu, signed by Oracle, secure and maintained
 FreePart of Always Free — no hidden billing

❌ Why Not Others?

ImageWhy Not
Ubuntu 20.04Older LTS, closer to end-of-life
Ubuntu 24.04Newer, but not all packages/tools have full support yet
Non-aarch64❌ Won’t boot on ARM (A1.Flex) — Oracle only supports aarch64 here
Full imagesMore packages = unnecessary bloat (especially on 6GB RAM)

✅ Final Answer:

ChooseCanonical Ubuntu 22.04 Minimal aarch64

This is the best fit for your Free Tier VM running Docker, Traefik, and microservices.

Q. What is Instance Metadata Service?

Great — keeping the cloud-init minimal is smart for now. Let’s now address:


✅ Instance Metadata Service (IMDS)

🔸 Should You Enable It?

✅ Yes, leave it enabled (default setting)

🔍 What is It?

Instance Metadata Service (IMDS) in Oracle Cloud provides runtime metadata about your instance. Think of it like a read-only endpoint at:

http://169.254.169.254/opc/v1/

From your VM, you can query:

  • Instance OCID, name, compartment
  • SSH keys
  • Region, availability domain
  • Custom metadata you’ve set

✅ Why You Should Enable It

Use CaseBenefit
DebuggingKnow where the instance is running, what's attached
AutomationPull instance data dynamically from within scripts
MonitoringCan be used by logging/monitoring agents
DevOps ExamIMDS is part of OCI security, automation, and bootstrapping questions

🔐 Security Tip:

  • Oracle’s IMDS is read-only and local to the instance, so it’s safe to enable by default
  • You can disable V1 endpoint or restrict HTTP headers later, but not needed for basic usage

✅ Recommendation:

Leave “Enable Instance Metadata Service” ✅ enabled Leave “Allow V1 metadata service endpoints” ✅ enabled (for now)

You’ll likely use this in later steps (e.g., auto-registering VMs, monitoring, tagging).

Q. Do we want to use initialization script?

Excellent question — and yes, using an initialization script (cloud-init) is a smart move. It helps you:

  • Automate first-time setup (like installing Docker)
  • Ensure the VM is immediately ready after launch
  • Make your blog post and Oracle DevOps prep even more robust (✨ infrastructure-as-code mindset)

✅ What You Can Automate in This Traefik VM's Init Script

Here’s a solid minimal cloud-init script to:

  • Update packages
  • Install Docker & Docker Compose plugin
  • Add user to Docker group
  • Enable Docker on boot

Paste this into the "Paste Cloud-Init Script" field under Advanced Options → Initialization script:

#cloud-config
package_update: true
package_upgrade: true

packages:
  - docker.io
  - docker-compose-plugin

runcmd:
  - systemctl enable docker
  - usermod -aG docker ubuntu
  - echo "Docker installed and ready"

We will intentionally keep it minimal and setup curlufwtraefik, etc manually so that we get the chance to explore the process from both perspectives(automated scripting, and manual setup).

✅ What This Does:

LinePurpose
package_update/upgradeEnsures system is up-to-date
docker.io, docker-compose-pluginInstalls both tools
systemctl enable dockerStarts Docker on reboot
usermodAdds ubuntu user to Docker group so no need for sudo docker
echoSimple log line

🧠 DevOps Certification Tip:

Cloud-init scripts are part of OCI instance provisioning and also connect with Terraform and CI/CD automation. Understanding and using them reflects good DevOps practice.


✅ Summary

TaskDecision
Use initialization script?✅ Yes
Use cloud-init or shell?✅ cloud-init (#cloud-config)
Install Docker + Compose?✅ Yes
Automate user config?✅ Yes

Q. Why does Estimated Cost is not zero?

 Great observation — this is a common point of confusion in Oracle Cloud Free Tier.

Let me explain what’s going on:


💡 Why You're Seeing a Cost Estimate ($2.76–$5)

  • Oracle Cloud always shows cost estimates, even for Always Free resources.
  • The system doesn’t immediately know whether you’re staying within the Free Tier limits, so it shows the regular price.
  • As long as your resource usage stays within Always Free quotasyou won’t be charged.

✅ You Are Still in Free Tier If:

ResourceLimitYour Setup
VM.Standard.A1.FlexUp to 4 OCPUs + 24GB RAM totalYou’re using 1 OCPU + 6GB RAM → ✅ ✅
Block Storage200 GB totalDefault 50 GB boot volume → ✅
Public IPs2 maxUsing 1 for Traefik → ✅
Total VMsNot limited by count, just quotaOnly 1 so far → ✅

🧠 Certification Tip:

Understanding billingquotas, and cost analysis tools is part of the OCI Foundations and DevOps Specialist exams. You’re expected to know:

  • How cost estimates ≠ charges
  • How to monitor usage via Cost Analysis + Usage Reports

🛑 TL;DR:

QuestionAnswer
Am I being charged?❌ No — as long as you stay within Free Tier limits
Why does it show cost?It shows regular pricing — doesn’t account for Free Tier credits in that view
Should I worry?✅ No — OCI’s billing system will bill you $0 unless you exceed the limits
Can I verify?✅ Yes — Use Billing → Cost Analysis after the instance runs for 24h+
Q. what should be the capacity type for this VM?  Options are: On-demand, Preemptible, capacity reservation, dedicated host, compute cluster?

This directly affects cost and availability, and choosing the wrong one could disqualify you from Free Tier.


✅ Use: On-demand

🟢 On-demand (Default)

  • ✅ Always Free eligible
  • ✅ Stable — runs until you stop it
  • ✅ Best for long-running services like Traefik

🔴 Do Not Use:

TypeWhy to Avoid
Preemptible✅ Cheaper (if paid), ❌ Not Free Tier eligible, VM can be terminated anytime
Capacity ReservationUsed for reserving capacity in advance — not needed, not relevant for Free Tier
Dedicated HostEntire physical host — ❌ not free, very expensive
Compute ClusterAdvanced, for HPC/AI workloads — ❌ not Free Tier and overkill

📘 Certification Insight:

In OCI DevOps and Architect certs, you'll be expected to know:

  • When to use on-demand vs preemptible
  • Preemptible = temporary workloads (e.g., CI/CD jobs)
  • On-demand = long-living apps (e.g., microservices, proxies)

✅ Final Answer:

✅ Use On-Demand capacity type for your Traefik VM — it’s eligible for Always Free, and ideal for 24/7 workloads.
Q. what's a fault domain?

Great question — fault domains are an important concept in cloud infrastructure design and appear frequently in Oracle Cloud certifications.


🔍 What is a Fault Domain in Oracle Cloud?

✅ Definition:

fault domain (FD) is a logical grouping of hardware within an availability domain (like a rack of servers). Oracle Cloud uses fault domains to help minimize the impact of physical hardware failures.


🧠 Think of it like:

Availability Domain (AD)
├── Fault Domain 1 (FD-1)
├── Fault Domain 2 (FD-2)
└── Fault Domain 3 (FD-3)

Each Availability Domain (data center) typically contains 3 fault domains.


🧯 Why It Matters

  • If a hardware failure (e.g., power, network switch, server crash) happens in one fault domain, other FDs remain unaffected.
  • Placing VMs in different FDs gives high availability within the same region.
📘 Example: If you're deploying a Kubernetes cluster or a database with replicas — put each node in a different fault domain.

🧠 For You (Free Tier Use Case)

You don’t need to worry much unless you're building a highly available architecture.

But:

  • If you deploy multiple VMs (e.g., Traefik + Keycloak + Supabase), you can optionally place them in different FDs to simulate HA best practices — a plus for certification and blog posts.

🔧 Where to Set It:

When creating a VM:

In Advanced Options → Placement, you'll see:

Fault Domain: [Let Oracle choose] [FD-1] [FD-2] [FD-3]
✅ It’s safe to let Oracle choose — or pick a specific one if you're doing HA testing.

✅ Summary

FeatureDescription
Fault DomainLogical isolation zone within a data center
PurposeProtect against localized hardware failures
Best PracticeDistribute critical workloads across FDs
Free TierOptional — but good practice if running >1 VM

✅ Networking Options

 Download both Public and Private SSH keys and store them securely. We will need them to connect via SSH

Q. On the netwokring options, under advanced options - should I enable "use network security groups to control traffic" option? Also, what about DNS record - shall we assign a private DNS record or not?

Great questions — both options impact your network architecture and security, and they're relevant for best practices and certification knowledge. Here's how to decide:


🔒 1. Use Network Security Groups (NSGs)?

✅ Short Answer:

Yes — enable NSGs now, or plan to set them up soon. But since we have not created NSG until this point, we will defer until later. Leave it disabled for now and let's move on.


🔍 What are NSGs?

  • NSGs (Network Security Groups) are like firewall groups for specific VNICs/instances
  • Unlike Security Lists, which apply to the entire subnet, NSGs apply to specific instances

✅ Benefits:

NSGSecurity List
Applies to specific VMsApplies to all VMs in a subnet
Fine-grained controlBroad, less flexible
Preferred for microservices, DevOps pipelinesGood for simple setups
✅ OCI Best Practice (and required for DevOps exam prep): use NSGs for services like Keycloak, Redis, Traefik to restrict inbound/outbound traffic per role/function.

👌 Recommendation:

OptionDo This
Use NSG✅ Enable the NSG option now
Create NSG laterStill OK — you can add NSGs post-launch
Skip forever❌ Avoid — not scalable or secure for production setups

🌐 2. Assign a Private DNS Record?

🧾 Option: Assign a private DNS record

FieldMeaning
✅ AssignAdds an internal DNS name for your instance like traefik.homelab.oraclevcn.com
❌ Do not assignLeaves it with only a private IP, no internal DNS

✅ Recommendation:

Enable: “Assign a private DNS record”
  • This will let you refer to internal VMs/services by name inside the VCN (e.g., keycloak.homelab.oraclevcn.com)
  • Useful when setting up Traefik routing, Docker containers, internal microservice calls

✅ Final Answers:

SettingRecommendationWhy
Use Network Security Groups✅ YesGranular firewall rules for your Traefik gateway and services
Assign Private DNS Record✅ YesEnables internal DNS name like traefik.homelab.oraclevcn.com — very useful for internal routing

✅ Final Configuration for Traefik Gateway VM:

OCI VM Instance Provisioning Screen:

✅ Click Create and wait 2–3 minutes.

See you in next part: [[004 Connecting via SSH and setting up Traefik]]