Tri Nguyen
Tri Nguyen

Intro

Oracle allow us to create free resources (such as VM) at their cloud services for testing. For examples, a VM.Standard.A1.Flex with maximal 4 OCPU and 24GB RAM is a good deal to host a website. However, the deal isn’t always available because the demand is always more then what Oracle can provide. If you try to create a free VM for now, you’ll receive an error “Out of capacity” most of the time. In this post, I’ll show you how to run a script which runs over the time and tries to create a VM until it gets success.

Steps

User Settings
Add API Key
key_file=oci_private_key.pem
Create a VM instance
Image and shape
Image and shape
Image and shape
Networking
Networking
Add SSH keys
Out of capacity for shape VM.Standard.A1.Flex in availability
domain OFDj:AP-SINGAPORE-1-AD-1. If you specified a fault domain,
try creating the instance without specifying a fault domain. If
that doesn’t work, please try again later. Learn more about host 
capacity.
DevTools
DevTools
instance_display_name = 'instance-********'
compartment_id = 'ocid1.tenancy.oc1..********'
domain = "OFDj:AP-SINGAPORE-1-AD-1"  # availability_domain
image_id = "ocid1.image.oc1.ap-singapore-1.********"
subnet_id = 'ocid1.subnet.oc1.ap-singapore-1.********'
ssh_key = "ssh-rsa ******** ssh-key-2022-01-14"
pip install requests
pip install oci
python3 oci_auto.py
Python
VM created successfully
Public IP Addresses
Ephemeral public IP
PuTTY
Instance details

Comments

If you have any question, you can start a new discussion.