oci iam compartment create --name 'Ajit' --description "Testing OCI"
{
"data": {
"compartment-id": "ocid1.tenancy.oc1.....",
------------------------------------------------------------------------------------------------------------------------------
With that you have place to create your resources with assumption that proper quota is allocated.
Each compartment needs to have VCN for proper seperation.
oci network vcn create --cidr-block 192.168.0.0/16 --display-name AjitVcn1 --dns-label AjitDns1
This will allow us to carve out subnet in the vcn
oci network subnet create --cidr-block 192.168.10.0/24 --vcn-id ocid1.vcn.oc1.iad.... --security-list-ids '["ocid1.securitylist.oc1...."]'
Both vcn-id and security-list-ids is taken from "oci network vcn create" output
------------------------------------------------------------------------------------------------------------------------------
oci network internet-gateway create --is-enabled true --vcn-id ocid1.vcn.oc1.iad.... --display-name AjitGW
After opening up the Gateway for the vcn, we need to streamline who can connect to our GW.
Route table info can be seen in "oci network subnet create" output.
oci network route-table update --rt-id ocid1.routetable.oc1.iad.... --route-rules '[{"cidrBlock":"0.0.0.0/0","networkEntityId":"ocid1.internetgateway.oc1.iad...."}]'
------------------------------------------------------------------------------------------------------------------------------
oci compute instance launch --display-name AjitVm --image-id ocid1.image.oc1.iad.... --subnet-id ocid1.subnet.oc1.iad.... --shape VM.Standard2.1 --assign-public-ip true --metadata '{"ssh_authored_keys":"ajit"}'
You can confirm the creation using "oci compute instance get"
Using the key, you can login thru opc user.