More Info:
Monitor changes to Internet and Dynamic Routing Gateways. Unauthorized gateway provisioning can create illicit bridges between secure private networks and the internet.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)
- Essential 8
- 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 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
Here’s how to configure an alert in OCI so you’re notified when gateways are changed, using only the OCI Console. This uses Events + Notifications, which is the correct way to monitor configuration changes (Monitoring service is metric-based).
If you need the rule narrowed down (e.g., only for Internet Gateways or only in production compartments), tell me which gateway types and compartments you use, and I can give you an exact event filter JSON.
1. Create a Notification Topic
- In the OCI Console, open the menu (☰) and go to:
Developer Services → Application Integration → Notifications - Make sure you’re in the correct compartment.
- Click Create Topic.
- Enter:
- Name: e.g.,
gateway-change-alerts-topic - Description: e.g.,
Alerts for OCI gateway create/update/delete changes
- Name: e.g.,
- Click Create.
2. Add a Subscription (e.g., Email or PagerDuty/Webhook)
- On the topic you just created, click its name to open it.
- Under Subscriptions, click Create Subscription.
- Choose Protocol:
- For email: choose Email and enter your address.
- For webhook/Slack/PagerDuty: choose HTTPS and enter the endpoint.
- Click Create.
- For email, check your inbox and confirm the subscription.
3. Create an Events Rule for Gateway Changes
- Open the menu (☰) and go to:
Observability & Management → Events Service - Pick the compartment where the gateways reside (or a higher-level compartment if you want broader coverage).
- Click Create Rule.
- Enter:
- Rule Name: e.g.,
gateway-change-events-rule - Description: e.g.,
Triggers on create/update/delete of gateways - State: leave as Enabled.
- Rule Name: e.g.,
- Under Rule Conditions, choose:
- Condition Type:
Event Type
- Condition Type:
- In Service Name, select Virtual Cloud Network (VCN) (or “Networking” depending on console wording).
- In Event Type, select all gateway-related change events you care about, for example:
CreateInternetGatewayUpdateInternetGatewayDeleteInternetGatewayCreateNatGatewayUpdateNatGatewayDeleteNatGatewayCreateDynamicRoutingGatewayUpdateDynamicRoutingGatewayDeleteDynamicRoutingGatewayCreateServiceGatewayUpdateServiceGatewayDeleteServiceGateway(Names may appear ascom.oraclecloud.virtualnetwork.createinternetgatewayetc.; select the create/update/delete events for each gateway type.)
- (Optional) Add Condition (Attributes) if you want to restrict to certain compartments, VCNs, or tags:
- Example: set
data.additionalDetails.compartmentIdto a specific Compartment OCID.
- Example: set
- Under Actions, click + Add Action:
- Action Type:
Notifications - Topic: select the topic you created (
gateway-change-alerts-topic).
- Action Type:
- Click Create Rule.
4. (Optional) Test the Alert
- Make a controlled gateway change in the target compartment, for example:
- Edit an Internet Gateway (change display name) or
- Create a temporary NAT Gateway and then delete it.
- Verify:
- The Events rule shows recent matches.
- You receive an email/webhook alert from the Notifications topic.
If you need the rule narrowed down (e.g., only for Internet Gateways or only in production compartments), tell me which gateway types and compartments you use, and I can give you an exact event filter JSON.
Using CLI
Using CLI
In OCI, “gateway change alerts” are best implemented with Events + Notifications, not a Monitoring metric alarm, because changes are configuration events, not metrics. You can still treat this as part of your alerting/monitoring posture.Below are step‑by‑step OCI CLI commands to create an email alert whenever a gateway (e.g., Internet Gateway) is created/updated/deleted.
Make sure your CLI is configured for the correct tenancy/profile and region:
Capture the topic OCID:
Then confirm the subscription from the email you receive; otherwise alerts won’t be delivered.
Or if you want this to apply to any compartment in the tenancy, omit the This rule sends a notification to the topic whenever an Internet Gateway is created, updated, or deleted.
Update the rule if you change the file:
This setup satisfies “gateway change alarm configured” using OCI’s native alerting pipeline (Audit → Events → Notifications) via the OCI CLI. If you specifically need a Monitoring alarm on a custom metric instead, you’d first send these events to a custom metric (via Service Connector Hub) and then create an
1. Set required variables
Replace the values with your own and export them (or just inline them into the commands).2. Create a Notifications topic
3. Create an email subscription
4. Create an Events rule for gateway changes
Below is an example rule for Internet Gateway changes via theVCN service (you can expand to NAT/DRG/etc. as needed).Create an event pattern JSON file gateway-change-pattern.json:compartmentId filter.Now create the Events rule:5. (Optional) Extend to other gateway types
Add additionaleventType values in gateway-change-pattern.json as needed, for example:- NAT Gateway:
com.oraclecloud.virtualnetwork.createnatgatewaycom.oraclecloud.virtualnetwork.updatenatgatewaycom.oraclecloud.virtualnetwork.deletenatgateway
- Dynamic Routing Gateway (DRG):
com.oraclecloud.virtualnetwork.createdrgcom.oraclecloud.virtualnetwork.updatedrgcom.oraclecloud.virtualnetwork.deletedrg
This setup satisfies “gateway change alarm configured” using OCI’s native alerting pipeline (Audit → Events → Notifications) via the OCI CLI. If you specifically need a Monitoring alarm on a custom metric instead, you’d first send these events to a custom metric (via Service Connector Hub) and then create an
oci monitoring alarm create on that metric.Using Python
Using Python
You remediate this by creating an automated alert whenever a gateway (Internet/NAT/DRG/etc.) is changed, using OCI Events + Notifications via the Python SDK.Below is a minimal step‑by‑step plus example Python code that you can adapt.
You must fill in the correct event types for gateway changes. Get them from:
1. Prerequisites
- Install OCI SDK:
- Configure your OCI credentials (user API key) in
~/.oci/config:
- Have:
compartment_ocidwhere gateways are located- An email address for alerts
2. High-level steps
- Create a Notifications topic.
- Create a subscription to that topic (e.g., email).
- Create an Events rule that:
- Listens to Audit events for VCN gateways in your compartment.
- Targets the Notifications topic.
- Test by updating/deleting a gateway and confirm email is sent.
3. Python example (end‑to‑end)
Important:You must fill in the correct event types for gateway changes. Get them from:
- Audit log of a sample gateway change in the OCI Console, or
- Events Console → “Create Rule” wizard → “Virtual Cloud Network (VCN)” → “Show JSON”.
GATEWAY_EVENT_TYPES with the list you get.4. How this satisfies “gateway change alarm” requirement
- Any Audit event that matches one of
GATEWAY_EVENT_TYPESin the target compartment will:- Trigger the Events rule.
- Send a message to the Notifications topic.
- Deliver an email (or other channel) to your configured endpoint.
- Change
COMPARTMENT_OCIDif you want tenancy‑wide monitoring. - Add/remove event types to cover Internet Gateways, NAT Gateways, DRGs, Local Peering Gateways, etc.
- Replace email with Slack/HTTPS, etc., by adjusting the subscription protocol.
Using Terraform
Using Terraform
oci_monitoring_alarm because OCI Monitoring does not expose gateway-change events as metrics. Use the Events service (in the Console: Developer Services → Events → Create rule, filtering on Audit events for Internet Gateway and Dynamic Routing Gateway create/update/delete) and attach a Notifications topic for alerting.
