CodexBloom - Programming Q&A Platform

OCI Networking: implementing Custom Route Table Not Applying to New Subnet in VCN

👀 Views: 277 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-09
oci networking vcn Python

I've tried everything I can think of but Could someone explain I'm sure I'm missing something obvious here, but I've searched everywhere and can't find a clear answer..... I'm working with a question where a custom route table I created in OCI is not being applied to a new subnet I added to my Virtual Cloud Network (VCN). I've followed the steps to create the route table and associated it with the subnet, but when I try to access resources in the subnet, I frequently receive a 'Route not found' behavior. To troubleshoot, I verified that the route table has a valid route to the internet gateway and reran the association command, but the scenario continues. Here's the code snippet I'm using to create the subnet and route table: ```python import oci # Initialize the client vcn_client = oci.core.VirtualNetworkClient(config) # Create a route table route_table_details = oci.core.models.CreateRouteTableDetails( compartment_id=compartment_id, display_name='my_route_table', routes=[ oci.core.models.RouteRule( destination='0.0.0.0/0', destination_type='CIDR', target_id=internet_gateway_id ) ] ) route_table = vcn_client.create_route_table(route_table_details) # Create a subnet subnet_details = oci.core.models.CreateSubnetDetails( compartment_id=compartment_id, vcn_id=vcn_id, display_name='my_subnet', cidr_block='10.0.1.0/24', route_table_id=route_table.data.id ) subnet = vcn_client.create_subnet(subnet_details) ``` Despite specifying the `route_table_id` in the subnet creation step, I still see the default route table associated with the subnet in the OCI console. I tried deleting and recreating the subnet, but the same scenario occurs. Is there something I'm missing in the configuration? Could there be a delay in propagation or a specific permission scenario preventing the route table from being set correctly? Any insights would be greatly appreciated! This is part of a larger service I'm building. Am I missing something obvious? I'm coming from a different tech stack and learning Python. Has anyone else encountered this? I'm using Python latest in this project. I'm developing on macOS with Python. I'd love to hear your thoughts on this.