More Info:
NetworkSecurityGroupChange events should be monitored. NSGs govern granular instance-level access, and unapproved modifications can compromise micro-segmentation boundaries.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 configure an alarm/alert for NSG (Network Security Group) changes in OCI using the console. In OCI, this is done with Events + Notifications (which is still “alerting/monitoring,” but event‑driven rather than metric‑driven).
This setup ensures OCI monitoring/alerting is in place for any NSG configuration changes via the Events service integrated with Notifications.
1. Create a Notifications Topic
- In the OCI Console, open the Navigation menu (☰).
- Go to Developer Services → Application Integration → Notifications.
- Make sure you’re in the correct compartment.
- Click Create Topic.
- Enter:
- Name: e.g.
nsg-change-alerts-topic - Description: e.g.
Alerts for OCI NSG configuration changes
- Name: e.g.
- Click Create.
2. Add a Subscription (Email or Other)
- After the topic is created, click the topic name (
nsg-change-alerts-topic). - Under Subscriptions, click Create Subscription.
- Choose Protocol (e.g.
Email). - Enter Endpoint (e.g. your email address).
- Click Create.
- Check your email and confirm the subscription via the confirmation link.
3. Create an Event Rule for NSG Changes
You want to fire an alert whenever a Network Security Group is created, updated, or deleted.- In the console, go to Observability & Management → Events Service → Rules.
- Ensure you are in the compartment where NSGs exist (or a higher-level compartment if you want broader scope).
- Click Create Rule.
- Fill in:
- Name:
nsg-change-event-rule - Description:
Trigger notification on NSG create, update, or delete - Status: leave as Enabled.
- Name:
- Under Rule Conditions:
- Choose Event Type:
- Click Edit or + Another Condition as needed.
- In Service Name, select Virtual Cloud Network (VCN) (sometimes labeled just Virtual Networking).
- In Event Type, select events related to NSG:
CreateNetworkSecurityGroupUpdateNetworkSecurityGroupDeleteNetworkSecurityGroupUpdateNetworkSecurityGroupSecurityRules(very important for rule changes)
- If you cannot choose multiple explicitly, create multiple event type conditions combined with “Any” (OR) or create multiple rules (one per event type).
- Choose Event Type:
- Under Actions, choose:
- Action Type: Notifications
- Topic: select
nsg-change-alerts-topic.
- Click Create Rule.
4. (Optional) Narrow Down with Additional Filters
If you only want events for certain compartments or tags:- Edit the rule you just created.
- Under Condition, add a Custom Event Filter using Event JSON (Advanced) or UI filters such as:
- Compartment OCID
- Defined tags / freeform tags
- Save the rule.
5. Test the Configuration
- Go to Networking → Virtual Cloud Networks → Network Security Groups.
- In the target compartment, pick an NSG.
- Perform a change, for example:
- Add or remove an NSG security rule, or
- Create a new NSG.
- Within a few minutes, you should receive an email (or selected protocol) indicating an NSG change event.
This setup ensures OCI monitoring/alerting is in place for any NSG configuration changes via the Events service integrated with Notifications.
Using CLI
Using CLI
In OCI, configuration-change “alarms” for NSGs are implemented with Events + Notifications, not Monitoring metrics. Below are the exact steps using the OCI CLI.
Then confirm the subscription from the email you receive.
If in a file, create the rule:(If you want a global rule, you can omit the
1. Prerequisites
Make sure your CLI is configured and you have:2. Create a Notifications Topic
3. Create a Subscription (e.g., Email)
4. Create an Events Rule for NSG Changes
This rule triggers when NSGs are created/updated/deleted or when rules change.Prepare the condition JSON (you can inline it or put it in a filensg-change-condition.json):compartmentId filter from additionalDetails.)5. Test the Alert
Perform any NSG change in the compartment (e.g., add a security rule) and verify that you receive an email notification.If you specifically need this expressed as a “Monitoring alarm,” you would still rely on this Events + Notifications pattern, since NSG configuration changes are not exposed as a standard Monitoring metric.Using Python
Using Python
In OCI, configuration changes (including NSG changes) are exposed via Events, not Monitoring metrics.
To “alarm” on NSG changes you create:
You must confirm the subscription from the email that OCI sends.
We match event types like:
To “alarm” on NSG changes you create:
- A Notifications topic
- An Events rule that matches Network Security Group change events and sends them to the topic
- (Optionally) subscribe email/Slack/etc. to the topic
1. Prerequisites
- Install OCI Python SDK
- Configure OCI CLI profile (used by SDK)
~/.oci/config:- IAM Policies
2. Create Notifications Topic and Subscription (Python)
3. Create Events Rule for NSG Changes (Python)
NSG (Network Security Group) change events come from the Virtual Network service.We match event types like:
com.oraclecloud.virtualnetwork.createNetworkSecurityGroupcom.oraclecloud.virtualnetwork.updateNetworkSecurityGroupcom.oraclecloud.virtualnetwork.deleteNetworkSecurityGroup
4. Validate
- Create or modify an NSG in the same compartment:
- e.g., add/remove a security rule.
- Wait a few minutes.
- You should receive an email notification from the topic you created.
5. Key Points
- NSG change “alarms” are implemented via Events + Notifications, not standard Monitoring metrics.
- The Python SDK uses:
oci.ons.NotificationControlPlaneClientfor topics/subscriptions.oci.events.EventsClientfor rules.
- Make sure the service events is allowed to use the ONS topic via IAM policy.
Using Terraform
Using Terraform
terraform plan should show either:+ oci_monitoring_alarm.nsg_change_alarm(if new), or~ oci_monitoring_alarm.nsg_change_alarmwith updates only to fields likenamespace,query,destinations,is_enabled, orseverity.

