Scenario A: Public Subnet

Scenario A consists of a virtual cloud network (VCN) with a regional public subnet , which are required for network connectivity to Compute instances in a tenancy. Public servers are created in separate availability domains  (ADs) for redundancy, and the VCN uses regional subnets because they're more flexible and easier to efficiently divide a VCN into subnets while also accounting for potential failure. The VCN is directly connected to the internet by way of an internet gateway . The gateway is also used for connectivity to an on-premises network. Any resource in an on-premises network that needs to communicate with resources in this VCN must have a public IP address and access to the internet.

Getting started with Oracle Cloud Infrastructure is easy because the subnet uses an initial default security list. This list contains security rules that allow typical required access (for example, inbound SSH connections and any type of outbound connections). Remember that security list rules only allow traffic and traffic not explicitly allowed by a security list rule is implicitly denied. The same is true for route rules, which also require that outbound traffic is explicitly allowed and that traffic to specific destinations is sent to the necessary gateway. Routing destinations outside the VCN must be reachable through a gateway you create and explicitly specify in a route table associated with the subnet a resource uses.

In this scenario, you add a new rule to the default security list. This rule is required to give the Compute instances access to the internet. You could instead create a custom security list for this rule and set up the subnet to use both the default security list and the custom security list, but that's outside the scope of this scenario.

Tip

Security lists are one way to control traffic in and out of the VCN's resources. You can also use network security groups

In this scenario, the subnet also uses the default route table, which starts out with no rules when the VCN is created. The table only needs a single rule for the internet gateway.

This scenario doesn't use a Dynamic Routing Gateway (DRG).

The following figure shows resources with public IP addresses in a regional public subnet, with redundant resources in the same subnet but in a different AD. The public subnet route table allows all incoming traffic to enter and leave the public subnet through the internet gateway, uses the default security list, and uses the local routing that's built in to the VCN. The on-premises hosts must have public IP addresses to communicate with VCN resources over the internet.

This image shows Scenario A: a VCN with a regional public subnet and internet gateway.
Callout 1: Regional public subnet route table
Destination CIDR Route target
0.0.0.0/0 Internet Gateway

Required IAM Policy

To use Oracle Cloud Infrastructure, an administrator must be a member of a group granted security access in a policy  by a tenancy administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don't have permission or are unauthorized, verify with the tenancy administrator what type of access you have and which compartment  your access works in.

If you're a member of the administrators group, you probably already have the required access to implement Scenario A. Otherwise, you need access to Networking, and you need the ability to create instances. See IAM Policies for Networking.

Setting Up Scenario A in the Console

Setup is easy in the Console.

Note

If you haven't created a VCN before, the workflow discussed at Create a VCN with Internet Connectivity is an easy way to create a VCN with public and private subnets, gateways, and the route rules and security rules needed to provide internet access to instances and other resources in the VCN. If you use the workflow to perform this task, the workflow can handle Tasks 1 to 5 in this scenario.

Setting Up Scenario A with the API

For information about using the API and signing requests, see REST API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.

Use the following operations:

  1. CreateVcn: Always include a DNS label for the VCN if you want the instances to have hostnames (see DNS in Your Virtual Cloud Network).
  2. CreateSubnet: Create one regional public subnet. Include a DNS label for the subnet if you want the instances to have hostnames. Use the default route table, default security list, and default set of DHCP options.
  3. CreateInternetGateway
  4. UpdateRouteTable: To enable communication with the internet gateway, update the default route table to include a route rule with destination = 0.0.0.0/0, and destination target = the internet gateway. This rule routes all traffic destined for addresses outside the VCN to the internet gateway. No route rule is required to route traffic within the VCN itself.
  5. UpdateSecurityList: To allow specific types of connections to and from the instances in the subnet.
Important

Security List Rule for Windows Instances

If you're going to create Windows instances, you need to add a security list rule to enable Remote Desktop Protocol (RDP) access. To enable RDP, you need a stateful ingress rule for TCP traffic on destination port 3389 from source 0.0.0.0/0 and any source port. For more information, see Security Lists.

The next step is to create one or more instances in the subnet. The scenario's diagram shows instances in two different availability domains. When you create the instance, you select the AD, which VCN and subnet to use, and several other characteristics.

Each instance automatically gets a private IP address. When you create an instance in a public subnet, you decide whether the instance gets a public IP address. With this network setup in Scenario A, you must give each instance a public IP address, or else you can't access them through the internet gateway. The default (for a public subnet) is for the instance to get a public IP address.

After creating an instance in this scenario, you can connect to it over the internet with SSH or RDP from an on-premises network or other location on the internet. For more information and instructions, see Creating an Instance.