Creating Applications

You can create applications in Oracle Functions in readiness for deploying functions. An application need not contain any functions.

You can create applications using the Console, the Fn Project CLI, and the API.

For more information about applications, see Applications.

Using the Console

To create a new application in Oracle Functions using the Console:

  1. Confirm that you have completed the steps in the Functions QuickStart Guides.
  2. Sign in to the Console as a functions developer.
  3. In the Console, open the navigation menu and click Developer Services. Under Functions, click Applications.
  4. Select the region you are using with Oracle Functions. Oracle recommends that you use the same region as the Docker registry that's specified in the Fn Project CLI context (see Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure).
  5. Select the compartment specified in the Fn Project CLI context (see Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure).

    The Applications page shows the applications already defined in the compartment.

  6. Click Create Application and specify:

    • A name for the new application (for example, acmeapp). Avoid entering confidential information.
    • The VCN and subnet (or subnets, up to a maximum of three) in which to run functions. For example, a VCN called acme-vcn-01 and a public subnet called Public Subnet IHsY:US-PHOENIX-AD-1). Note that a public subnet requires an internet gateway in the VCN, and a private subnet requires a service gateway in the VCN. If a regional subnet has been defined, best practice is to select that subnet to make failover across availability domains simpler to implement. If a regional subnet has not been defined and you need to meet high availability requirements, select multiple subnets. Oracle recommends that the subnets are in the same region as the Docker registry that's specified in the Fn Project CLI context (see Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure).

      Note that specifying a private subnet for an application does not prevent access from the internet to the invoke endpoints of functions in the application. Use identity policies to control access to function invoke endpoints (see Controlling Access to Invoke and Manage Functions).

  7. Click Create.

    The new application appears in the list of applications.

Using Fn Project CLI Commands

To create a new application in Oracle Functions using the Fn Project CLI:

  1. Log in to your development environment as a functions developer.

  2. In a terminal window, create a new application by entering:

    fn create app <app-name> --annotation oracle.com/oci/subnetIds='["<subnet-ocid>"]'

    where:

    • <app-name> is the name of the new application. Avoid entering confidential information.
    • <subnet-ocid> is the OCID of the subnet (or subnets, up to a maximum of three) in which to run functions. Note that a public subnet requires an internet gateway in the VCN, and a private subnet requires a service gateway in the VCN. If a regional subnet has been defined, best practice is to select that subnet to make failover across availability domains simpler to implement. If a regional subnet has not been defined and you need to meet high availability requirements, specify multiple subnets (enclose each OCID in double quotes separated by commas, in the format '["<subnet-ocid>","<subnet-ocid>"]'). Oracle recommends that the subnets are in the same region as the Docker registry that's specified in the Fn Project CLI context (see Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure).

      Note that specifying a private subnet for an application does not prevent access from the internet to the invoke endpoints of functions in the application. Use identity policies to control access to function invoke endpoints (see Controlling Access to Invoke and Manage Functions).

    For example:

    fn create app acmeapp --annotation oracle.com/oci/subnetIds='["ocid1.subnet.oc1.phx.aaaaaaaacnh..."]'

    An application is created in Oracle Functions, in the tenancy and region implied by the subnet OCID and belonging to the compartment specified in the Fn Project CLI context file.

  3. Verify that the new application has been created by entering:

    fn list apps

    For example:

    $ fn list apps
    
    acmeapp