More Info:
VCN lifecycle events must be tracked via Event Rules. Deploying rogue virtual networks is often a precursor to launching illicit infrastructure or isolated cryptomining rigs.Risk Level
MediumAddress
Compliance, SecurityCompliance Standards
- APRA CPS 234 (Australia)
- AWS Well Architected Framework
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS AWS
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- HIPAA
- HITRUST CSF
- ISO 27001
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST
- NIST CSF
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- SOC2
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are concise, step‑by‑step instructions to create an OCI Event Rule for VCN changes and wire it into alerting via Notifications (and optionally Monitoring Alarms), using only the OCI Console.
Replace
1. Prerequisites
- Make sure you have:
- Permissions to manage
eventsandons(Notifications) in the target compartment.
- Permissions to manage
- Decide:
- Which compartment you want to monitor VCN changes in.
- Where you want alerts to go (email, Slack via HTTPS, PagerDuty, etc.).
2. Create a Notifications Topic
- Sign in to OCI Console.
- Open the hamburger menu → Developer Services → Notifications → Topics.
- Click Create Topic.
- Name: e.g.,
vcn-change-alerts-topic - Compartment: Choose the target compartment.
- Name: e.g.,
- Click Create.
Add a Subscription
- Open the topic you just created.
- Under Subscriptions, click Create Subscription.
- Choose:
- Protocol: e.g.,
Email. - Email: enter the recipient address.
- Protocol: e.g.,
- Click Create.
- Go to your email and confirm the subscription (mandatory).
3. Create an Event Rule for VCN Changes
- Open the hamburger menu → Observability & Management → Events Service → Rules.
- Make sure the compartment is the one where you want the rule to live.
- Click Create Rule.
Rule Details
- Name: e.g.,
detect-vcn-changes. - Description:
Alert on VCN create, update, and delete events. - State: Ensure it is set to Enabled.
Define the Event Pattern
You have two main options:Option A: Use the Basic Pattern (Service + Event Types)
- Under Rule Conditions, select:
- Service Name:
Networking(orVirtual Cloud Networkdepending on console wording).
- Service Name:
- For Event Type, select VCN-related events such as:
com.oraclecloud.virtualnetwork.createvcn.endcom.oraclecloud.virtualnetwork.updatevcn.endcom.oraclecloud.virtualnetwork.deletevcn.end(Name may appear slightly differently; pick all VCN Create/Update/Delete event types).
- Narrow by Compartment:
- Choose the compartment where the VCNs are/will be created (or
rootif you want tenancy-wide and then filter via conditions or multiple rules).
- Choose the compartment where the VCNs are/will be created (or
Option B: Use an Advanced Pattern (if needed)
- Switch to Use a Custom Event Pattern (Advanced).
- Use a filter similar to:
<OCID_OF_TARGET_COMPARTMENT> with your compartment OCID if you want to constrain scope.4. Add the Action (Send Notification)
- In the Actions section of the rule, click Add Action.
- Action Type:
Notifications. - Topic: Select the topic you created (
vcn-change-alerts-topic). - Click Add.
- Click Create to finalize the Event Rule.
5. (Optional) Integrate with Monitoring Alarms
If you specifically want OCI Monitoring Alarms (metrics‑based) in addition to event‑based notifications:- Typically, VCN configuration changes are event‑driven, not metric‑driven, so you:
- Keep the Event Rule to push messages via Notifications to people/tools.
- Use Monitoring Alarms for metrics (e.g., traffic, errors) separately.
- If you want an alarm-like behavior:
- Create an Alarm in Observability & Management → Monitoring → Alarms for relevant network metrics (e.g., dropped packets, high traffic) and send it to the same Notifications topic.
6. Validate the Setup
- Make a small, safe VCN change in the monitored compartment:
- e.g., update the VCN display name or create a test VCN.
- Confirm:
- Event Rule logs an invocation (visible in Events Service details).
- A notification email (or other protocol message) is received at the configured subscription.
Using CLI
Using CLI
Below are step‑by‑step OCI CLI instructions to ensure Monitoring/Alerting is in place for VCN changes by creating an Events rule that triggers a Notifications topic whenever a VCN is created/updated/deleted.
Save the output as:
Confirm the subscription by clicking the link in the email.
You can also filter to a specific compartment or VCN by filling The CLI expects it like this:To avoid confusion, simply create a single correct condition file:Final
This creates a rule that:
Once these steps are done, your OCI environment will have an Events rule that alerts (via Notifications) for all VCN configuration changes, satisfying the requirement “OCI Monitoring Should Have Event Rule For VCN Changes.”
0. Prerequisites
-
OCI CLI installed and configured (
oci setup configalready done). -
Your compartment OCID is known:
-
You have permission to use:
oci ons(Notifications)oci eventsoci iam(if you need policies)
1. (Optional) Create a Notifications Topic
If you already have a Notifications topic you want to use, skip to step 3 and use its OCID.2. (Optional) Add a Subscription to the Topic
For example, an email subscription:3. Create Event Rule JSON Condition for VCN Changes
Create a filevcn-events-condition.json:data.compartmentId or data.resourceName arrays, but for all VCNs, leave them empty as above.Wrap this in the Events Rule “condition” structure (OCI requires "eventType" and "data" to be inside "conditions"):Create vcn-rule-condition.json:vcn-rule-condition.json:4. Create the Events Rule
Use the Notifications topic as the rule’s action:- Listens for these event types:
com.oraclecloud.virtualnetwork.createvcncom.oraclecloud.virtualnetwork.updatevcncom.oraclecloud.virtualnetwork.deletevcn
- Sends a notification to the ONS topic when they occur.
5. (Optional) Verify the Rule
List rules in the compartment:6. (Optional) Update an Existing Rule
If a rule exists but lacks VCN events, adjust it:-
Get the rule OCID:
-
Update the
conditionfile with VCN event types and then run:
Once these steps are done, your OCI environment will have an Events rule that alerts (via Notifications) for all VCN configuration changes, satisfying the requirement “OCI Monitoring Should Have Event Rule For VCN Changes.”
Using Python
Using Python
Below is a concrete way to remediate “OCI Monitoring should have Event Rule for VCN changes” using Python and the OCI SDK.Goal
Create an Event Rule that listens to VCN configuration changes and sends alerts (via OCI Notifications / Monitoring).Assumptions
To be more precise, you can match:
You can further constrain by
Create an Event Rule that listens to VCN configuration changes and sends alerts (via OCI Notifications / Monitoring).Assumptions
- You have:
- OCI tenancy, compartment OCID
- Proper IAM permissions:
manage events-rules,manage ons-topics, etc. - Working
~/.oci/configprofile (or equivalent config in environment variables).
- You want:
- An Events rule that triggers when a VCN is created/updated/deleted.
- An alert via Notifications (email) or similar.
1. Define what events you want to capture
Typical VCN configuration change events come from thecom.oraclecloud.virtualnetwork service and category Resource (or Api depending on how strict you want). Safe generic pattern:com.oraclecloud.virtualnetwork.vcn.createcom.oraclecloud.virtualnetwork.vcn.updatecom.oraclecloud.virtualnetwork.vcn.delete
2. Create (or reuse) a Notifications topic
You generally want the Event Rule to send messages to an OCI Notifications topic, then subscribe email / HTTPS, etc.Sample Python script: create topic (if not exists) and subscription
3. Create the Event Rule for VCN changes
Use the Events client and create a rule that:- Targets your compartment
- Has an event pattern that matches VCN changes
- Uses the Notifications topic (
topic_id) as an action
Event pattern (example)
This pattern matches all VCN events (create, update, delete):data.compartmentId or other fields if needed.Python script to create the Event Rule
4. (Optional) Integrate with Monitoring Alarms
If your security standard specifically wants Monitoring service to raise alarms from events, you can:- Use Event Rule → Notifications → custom HTTPS endpoint.
- That endpoint can push metrics (via
oci.monitoring.MonitoringClient) and then: - Create a Monitoring Alarm on those custom metrics.
5. Validation
- Confirm Notifications subscription.
- Create/update/delete a test VCN in the compartment.
- Verify that:
- Event shows in OCI Console → Observability & Management → Events.
- Notification is received at your configured endpoint.
Using Terraform
Using Terraform
oci_events_rule itself.For verification, terraform plan should show this oci_events_rule.vcn_lifecycle_events being created (or updated if you are adding the condition to an existing rule), with is_enabled = true and the condition JSON listing the three com.oraclecloud.virtualnetwork.*vcn event types.
