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.
Keyless: connect an OCI compartment
Section titled “Keyless: connect an OCI compartment”What you need
Section titled “What you need”- 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
adminscope in Mayadyn.
Step 1: create the connection
Section titled “Step 1: create the connection”Console
- Open Cloud accounts and choose Connect account.
- 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. - Keep Keyless. Enter Tenancy OCID and Compartment Mayadyn works in.
- Choose Connect account. The Trust steps dialog opens.
CLI
cat > oci-keyless.json <<'EOF'{"type": "mayadyn_admit", "tenancy_ocid": "ocid1.tenancy.oc1..<tenancy>", "compartment_ocid": "ocid1.compartment.oc1..<compartment>"}EOFmayadyn connections add --provider oci --name oci-jeddah --region me-jeddah-1 --credentials oci-keyless.jsonmayadyn connections setup oci-jeddahOnly 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:
-
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 tenancyAdmit dynamic-group MayadynPlatform of tenancy Mayadyn to inspect tenancies in tenancyWhen the compartment is the root compartment, the two
managestatements readin 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. -
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.
-
In Mayadyn, choose Check on the connection (or run
mayadyn connections verify <name>). It should turn Working.
What the policy grants, and why
Section titled “What the policy grants, and why”| 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_ocidmust be the compartment’s own tenancy. Otherwise the check fails withconnection_not_bound.
Revoke access
Section titled “Revoke access”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.
Errors you may see
Section titled “Errors you may see”| 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. |
API key: connect with a stored key
Section titled “API key: connect with a stored key”Use this when keyless is not an option for you.
Step 1: create an API key in OCI
Section titled “Step 1: create an API key in OCI”-
Pick or create an OCI user for Mayadyn.
-
Add an API signing key to the user (Identity → Users → API keys). Keep the private key (PEM) and note the fingerprint.
-
Give the user’s group these permissions:
- manage
instance-familyin the compartment; - manage
virtual-network-familyin 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 tenancyAllow group <group> to inspect tenancies in tenancyThe two
inspectstatements let Mayadyn read the compartment and the tenancy’s region subscriptions. - manage
Step 2: create the connection
Section titled “Step 2: create the connection”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>"}mayadyn connections add --provider oci --name oci-jeddah --region me-jeddah-1 --credentials oci-key.jsonCredentials are encrypted and never shown again after saving. Every use is recorded in the audit log (“Used account credentials”).
Errors you may see
Section titled “Errors you may see”| 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. |
Switch to keyless later
Section titled “Switch to keyless later”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.
Regions
Section titled “Regions”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.
Stopping on OCI
Section titled “Stopping on OCI”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.