Chanveasna ENG Logo
CHANVEASNA ENGDigital Architecture & Automation
Back to Articles
blog

How to get Oracle E2.Micro Instance: Always Free Tier Guide

By Chanveasna ENG7 min read
#Oracle Cloud#VPS#Automation#Terraform#DevOps
Medieval Diamond Section Divider

Introduction

In this guide, I will walk you through provisioning an Always Free VPS instance on Oracle Cloud Infrastructure (OCI). While the setup involves navigating multiple dashboard screens, the core hurdle most developers encounter is the common Out of Capacity error during creation.

Because Oracle allocates a finite pool of Always Free compute per region, high-demand data centers frequently exhaust their unreserved capacity. Below, you will find both the end-to-end dashboard setup and an automated Terraform polling script to secure an instance the moment compute becomes available.

You can jump directly to the automation script using the table of contents.

Get Started With Creating Account

Visit www.oracle.com/cloud/ to begin.

  1. Click Try OCI for free.

Oracle Cloud

Review the Always Free services available, then proceed to account registration.

  1. Click Start for free.

Free Tier

  1. Enter your account information and country location.

Basic Info Form

  1. Create a secure password following OCI complexity rules.

Password and Rules

  1. Choose a unique cloud account name.

Important: You can only provision Always Free instances in your assigned Home Region. This selection cannot be changed later. Choose a region close to your primary location with known Always Free capacity.

Picking Home Region Screen

  1. Check your inbox and click Verify Email.

Confirm Email

  1. Complete the required address and contact fields.

Address and Location

  1. Add a payment method for identity verification.

Note: Oracle requires a valid debit or credit card (prepaid cards are not accepted) for identity verification. No charges are billed for Always Free tier usage.

Add Payment Method to Verify

  1. Enter your billing details to finalize card verification.

Add Payment Method Page

  1. Accept the terms of service and click Complete Sign-Up.

Agree to Terms and Create Account

  1. Oracle will provision your tenancy and send a confirmation email once ready.

Wait Page

Wait Page 2

  1. Once your tenancy is active, log into the OCI Console.

Email Account Creation Completed

  1. Configure Two-Factor Authentication (2FA) to secure your account.

2-factor-auth

  1. Tip: You can use any TOTP app (Google Authenticator, Bitwarden, 1Password) by selecting “Another Authentication App” instead of the proprietary Oracle Mobile Authenticator.

2-factor-auth-setup

  1. You will now be redirected to the OCI Console dashboard.

We are in

Create Instance

Start Creating VM

  1. In the dashboard, click Create a VM instance under Build & Compute.

Dashboard’s View

  1. Name your instance and select your availability domain.

Name Instance

  1. Under the Image section, click Change image.

OS Image

  1. Select your preferred Linux distribution (e.g., Ubuntu).

OS Image Selection

  1. Select your version (e.g., 24.04 Minimal for a lean installation).

OS Version Selection

  1. Click Change Shape to configure instance hardware.

Server Spec

  1. Under Shape series, select Virtual Machine.

VM and Special Instance?

  1. In the shape table, select a shape tagged Always Free Eligible (1 OCPU corresponds to 1 CPU core on AMD/Intel shapes).

Free Tier Available

  1. Note: Ampere ARM shapes may require a standard (non-minimal) OS image depending on regional availability.

No Ampere Instance :(

  1. Confirm your shape selection.

Instance Shape

  1. Shielded Instance options provide firmware-level verification. For standard development workloads, you can leave default settings.

Security

  1. If your tenancy does not automatically assign a Virtual Cloud Network (VCN), create one using the VCN Wizard.

Create New VCN?!

Subnet

Public Subnet

  1. Ensure public IPv4 address assignment is enabled so your instance can connect to the internet.

No IPv4?

Creating VCN

  1. In a separate browser tab, navigate to Networking > Virtual Cloud Networks.

Network Oracle Services Listing Page

  1. Click Create VCN Wizard—the fastest way to generate subnets, gateways, and route tables automatically.

Networking Overview

  1. Enter a VCN name and leave default CIDR blocks.

Naming VCN

VCN Configuration CIDR…

  1. Verify that public and private subnets use distinct CIDR blocks.

Public and Private Subnet CIDR

  1. Review configuration and click Create.

Summary Page before Creation

  1. Once provisioning completes, close the VCN wizard tab.

VCN Creating

VCN Listing Page

Back to Instance Creation Page

  1. Return to the instance creation tab and select your newly created VCN (my-primary-vcn).

Configure VCN

  1. Verify that a public IPv4 address is assigned to the instance.

IPv4 on Public Subnet

IPv4 Assignment

  1. Configure your SSH keys. You can paste an existing public key (.pub) or choose Generate a key pair for me. Be sure to download the private key immediately.

SSH Key setup.

  1. Review boot volume defaults and click Next.

Boot Volume

  1. On the final review page, click Create.

Summary Page for Instance

  1. If regional capacity is constrained, OCI will return an “Out of capacity” error.

API request error, OUT OF CAPACITY

Workaround for the Out of Capacity Problem (Linux)

If you hit the “Out of capacity” error, you do not need to manually check the dashboard every day. We can automate resource provisioning using Terraform and a simple loop script that retries until capacity opens up.

  1. On the review page, click Save as stack to export your configuration. In the stack details view, click Download Terraform configuration to save the .zip archive to your machine.

Stack Job Page

  1. Extract the downloaded configuration on your machine or server:
mkdir ~/oracle-instance-grabber
cd oracle-instance-grabber
unzip ~/Downloads/<Your_Terraform_Config>.zip
sudo apt install tmux  # Used for running background processes

List files and Install Tmux

  1. Install Terraform following the official HashiCorp Installation Guide:

Hashicorp Developer Website

Installation Script

Install from Terminal

  1. Create an automated retry script:
nano grab_oracle.sh

Paste the following script:

#!/bin/bash

while true; do
  echo "Attempting to create instance: $(date)"

  # Run terraform apply
  # -auto-approve skips the [yes/no] prompt
  terraform apply -auto-approve

  # Check if it succeeded (Exit code 0 means success)
  if [ $? -eq 0 ]; then
    echo "SUCCESS! Server created at $(date)"
    exit 0
  fi

  echo "Failed (Out of capacity). Sleeping for 60 seconds..."
  sleep 60
done

grab_oracle.sh

  1. Update main.tf with your OCI API credentials:

main.tf provider

provider "oci" {
  tenancy_ocid     = "ocid1.tenancy.oc1.."
  fingerprint      = ""
  user_ocid        = "ocid1.user.oc1.."
  region           = "<your region>"
  private_key_path = "/home/<your username>/.oci/key.pem"
}

Finding Credentials to Run Terraform

  1. Find your Tenancy OCID under Profile > Tenancy:

Account info in Oracle

Account Tenancy Detail

  1. Find your User OCID under Profile > User Settings:

Account info in Oracle

User Setting

  1. Under API Keys, click Add API Key:

Detail Tabs

Add API Key Page

  1. Download your generated private key, click Add, and copy the configuration snippet.

Creating Tokens and Key

Running the Script

  1. Move your private key to your .oci directory and restrict file permissions:
mkdir -p ~/.oci
mv ~/Downloads/<your-key-file>.pem ~/.oci/key.pem
chmod 400 ~/.oci/key.pem
  1. Initialize Terraform in your project directory:
terraform init

Listing file and start tmux session

  1. Launch the script inside a persistent tmux session:
tmux new -s oracle-grabber
chmod +x grab_oracle.sh
./grab_oracle.sh

Start Running!!!

  1. The script will continue retrying until an instance successfully provisions. It polls every 60 seconds to avoid rate limits or API abuse flags from Oracle. As soon as another tenant decommissions a VM or regional capacity frees up, the script executes terraform apply and claims the instance.

To exit the tmux session without terminating the background script, press Ctrl + b followed by d to detach.

To check script progress at any point, re-attach to the session:

tmux attach -t oracle-grabber

Once provisioned, your instance will appear in the OCI dashboard with an assigned public IPv4 address ready for SSH access.

Success

With your Always Free cloud instance running, you now have a reliable 24/7 environment to deploy Docker containers, automated workflows, or personal web services at zero cost.

Medieval Corner Flourish
Medieval Corner Flourish
Medieval Corner Flourish
Medieval Corner Flourish
Chanveasna Eng Headshot
Digital Systems Architect & Automation Specialist

Chanveasna Eng

I build custom web applications, workflow automations, and messaging bots that eliminate manual data entry and keep business tools reliably in sync.

Medieval Diamond Section Divider

Related Articles

View Archive →