Skip to content

Connect Oracle Cloud (OCI)

A Mayadyn connection to Oracle Cloud works in one compartment of one tenancy. There are two ways to connect:

  • Keyless (recommended). A policy in your tenancy admits Mayadyn, and a tag on the compartment ties it to this one connection. Mayadyn stores no key.
  • API key. You create an API signing key for an OCI user and give it to Mayadyn, which stores it encrypted.
  • Your tenancy OCID (ocid1.tenancy.oc1..…).
  • The OCID of the compartment Mayadyn will work in (ocid1.compartment.oc1..…). To use the root compartment, give the tenancy OCID again. The compartment must be in that tenancy.
  • Permission in your tenancy to create policies in the root compartment and to edit the compartment’s tags.
  • The admin scope in Mayadyn.

Console

  1. Open Cloud accounts and choose Connect account.
  2. Pick Oracle Cloud, enter a Name (e.g. oci-jeddah) and the Default region (e.g. me-jeddah-1). The tenancy must be subscribed to that region.
  3. Keep Keyless. Enter Tenancy OCID and Compartment Mayadyn works in.
  4. Choose Connect account. The Trust steps dialog opens.

CLI

Terminal window
cat > oci-keyless.json <<'EOF'
{"type": "mayadyn_admit",
"tenancy_ocid": "ocid1.tenancy.oc1..<tenancy>",
"compartment_ocid": "ocid1.compartment.oc1..<compartment>"}
EOF
mayadyn connections add --provider oci --name oci-jeddah --region me-jeddah-1 --credentials oci-keyless.json
mayadyn connections setup oci-jeddah

Only these three fields are accepted; anything else is refused, so a key can never be stored with a keyless connection by mistake.

The connection shows Needs fixing until you finish step 2. That is expected.

Step 2: run the trust steps in your tenancy

Section titled “Step 2: run the trust steps in your tenancy”

The Trust steps dialog (or mayadyn connections setup <name>) gives the exact text for your connection, with copy buttons. It has this shape:

  1. Create a policy in the tenancy’s root compartment with these statements:

    Define tenancy Mayadyn as <mayadyn-tenancy-ocid>
    Define dynamic-group MayadynPlatform as <mayadyn-dynamic-group-ocid>
    Admit dynamic-group MayadynPlatform of tenancy Mayadyn to manage instance-family in compartment id <compartment-ocid> where target.compartment.id = '<compartment-ocid>'
    Admit dynamic-group MayadynPlatform of tenancy Mayadyn to manage virtual-network-family in compartment id <compartment-ocid> where target.compartment.id = '<compartment-ocid>'
    Admit dynamic-group MayadynPlatform of tenancy Mayadyn to inspect compartments in tenancy
    Admit dynamic-group MayadynPlatform of tenancy Mayadyn to inspect tenancies in tenancy

    When the compartment is the root compartment, the two manage statements read in tenancy where target.compartment.id = '<tenancy-ocid>'.

    <mayadyn-tenancy-ocid> and <mayadyn-dynamic-group-ocid> identify Mayadyn’s own identity; the console fills them in. Copy them from the dialog rather than typing them.

  2. Add a freeform tag to the compartment (Identity → Compartments → Tags), keeping its other tags:

    mayadyn-connection = mayadyn:<workspace id>:<connection id>

    The value is the Trusted subject shown in the dialog.

  3. In Mayadyn, choose Check on the connection (or run mayadyn connections verify <name>). It should turn Working.

Statement Why Mayadyn needs it
manage instance-family in the compartment Create, start, stop and delete instances.
manage virtual-network-family in the compartment Create the mayadyn VCN, gateway, subnet and, for apps, a network security group.
inspect compartments in tenancy Read the compartment’s tag, and check that the compartment is in the tenancy you named.
inspect tenancies in tenancy Read the tenancy and its region subscriptions.

Mayadyn gets no permission to change tags or compartments. Only people in your tenancy can set the tag.

The tag ties the compartment to one connection

Section titled “The tag ties the compartment to one connection”

The policy admits Mayadyn as a whole, not one Mayadyn workspace. So before acting, Mayadyn reads the compartment’s mayadyn-connection tag and acts only if it equals this connection’s subject. No other Mayadyn workspace or connection can use your compartment, even one that names the same OCIDs.

Keep in mind:

  • Anyone in your tenancy who may update this compartment can move the tag. Give that right only to people who may also manage its instances and networks.
  • Keep the where target.compartment.id = '…' clause. Without it the grant reaches every sub-compartment, and a sub-compartment someone tags could be used through Mayadyn. With it, the grant covers this compartment only.
  • tenancy_ocid must be the compartment’s own tenancy. Otherwise the check fails with connection_not_bound.

Delete the policy, or remove the tag from the compartment. Mayadyn re-reads the tag at least every 5 minutes. After that, the connection fails its checks with connection_not_bound and Mayadyn cannot act in the compartment.

Code Meaning Fix
connection_not_bound The tag is missing or names another connection, Mayadyn cannot read the compartment (policy missing), or the compartment is not in tenancy_ocid. Apply the policy and the tag exactly as shown in Trust steps, then Check.
invalid_input The OCIDs are malformed, or the tenancy is not subscribed to the default region. Fix the values. The message lists the regions the tenancy has.

Use this when keyless is not an option for you.

  1. Pick or create an OCI user for Mayadyn.

  2. Add an API signing key to the user (Identity → Users → API keys). Keep the private key (PEM) and note the fingerprint.

  3. Give the user’s group these permissions:

    • manage instance-family in the compartment;
    • manage virtual-network-family in the compartment;
    • read the tenancy’s region subscriptions.

    For example:

    Allow group <group> to manage instance-family in compartment <compartment>
    Allow group <group> to manage virtual-network-family in compartment <compartment>
    Allow group <group> to inspect compartments in tenancy
    Allow group <group> to inspect tenancies in tenancy

    The two inspect statements let Mayadyn read the compartment and the tenancy’s region subscriptions.

Console: Cloud accounts → Connect account → Oracle Cloud, pick Stored key, and fill in:

Field Value
Tenancy OCID ocid1.tenancy.oc1..…
User OCID The user’s OCID.
Key fingerprint e.g. aa:bb:…
Private key (PEM) The whole PEM, including the BEGIN and END lines.
Key passphrase Optional; only if the key is encrypted.
Compartment OCID Optional. “Leave empty to use the tenancy root.”

CLI:

{"tenancy_ocid": "ocid1.tenancy.oc1..<tenancy>",
"user_ocid": "ocid1.user.oc1..<user>",
"fingerprint": "aa:bb:…",
"private_key": "-----BEGIN PRIVATE KEY-----\n…\n-----END PRIVATE KEY-----\n",
"passphrase": "",
"compartment_ocid": "ocid1.compartment.oc1..<compartment>"}
Terminal window
mayadyn connections add --provider oci --name oci-jeddah --region me-jeddah-1 --credentials oci-key.json

Credentials are encrypted and never shown again after saving. Every use is recorded in the audit log (“Used account credentials”).

Code Hint Mayadyn gives
auth_failed “Check the API key: user OCID, fingerprint and private key must match a key uploaded to that user.” Or: “Check private_key (PEM) and passphrase.”
not_found “The resource is gone, or the user’s IAM policy does not allow it: check the policy for the compartment.”
invalid_input Missing fields, a tenancy OCID that does not start with ocid1.tenancy., a private key that is not PEM, or a region the tenancy is not subscribed to.

Use Replace credentials on the connection with keyless values for the same tenancy, run the trust steps, then delete the API key in OCI. See Replace credentials.

The console offers these OCI regions first: me-jeddah-1 (Jeddah), me-dubai-1 (Dubai), me-abudhabi-1 (Abu Dhabi), eu-frankfurt-1 (Frankfurt), uk-london-1 (London), us-ashburn-1 (Ashburn). Other regions work if your tenancy is subscribed to them.

Mayadyn stops an OCI instance gracefully. If it has not stopped 3 minutes after the request, Mayadyn powers it off, so a stop can take up to about 4 minutes.