Attaching a VCN to a DRG
Attach a Virtual Cloud Network (VCN) to a Dynamic Routing Gateway (DRG).
A VCN can be attached to only one DRG at a time, but a DRG can be attached to more than one VCN. The attachment is automatically created in the compartment that holds the VCN. The VCN and DRG do not need to be in the same compartment. You may optionally specify a display name for the attachment itself, otherwise a default is provided. You can choose to connect VCNs in the same region using a single DRG instead of local peering gateways (see Local VCN Peering Through an Upgraded DRG for more information about that use case). If left unmodified, the default routing policies in a DRG allow traffic to be routed between all VCNs attached to it. If you are attaching a DRG to a VCN in another tenancy, you need to have IAM configurations in both tenancies as described in IAM Policies for Routing Between VCNs. You will also need the OCID of the VCN.
When you create an attachment to a DRG (the DRG can be in another tenancy in the same
OCI region), attachments on both the DRG and VCN are created and connected in one
step. Attaching a DRG to a VCN results in a DrgAttachment
object
with its own OCID.
The attachment is in the "Attaching" state for a short period.
When the attachment is ready, create a route rule in the subnet's route table directing subnet traffic to the DRG. See To route a subnet's traffic to a DRG.
Use the network drg-attachment create command and required parameters to attach a VCN to a DRG:
oci network drg-attachment create --drg-id drg-ocid --network-details [complex type] ...[OPTIONS]
For a complete list of parameters and values for CLI commands, see the CLI Command Reference.
Run the CreateDrgAttachment operation to create a DRG attachment to a VCN.