Creating Applications

Find out how to create applications with OCI Functions.

You can create applications in OCI 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.

  • To create a new application in OCI 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 OCI 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 that are already defined in the compartment.

    6. Click Create Application and specify the following details:

      • Name: A name for the new application (for example, acmeapp). Avoid entering confidential information.
      • VCN: The VCN in which to run functions. For example, a VCN called acme-vcn-01
      • Subnets: The subnet (or subnets, up to a maximum of three) in which to run functions. For example, 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).

      • Shape: The processor architecture of the compute instances on which to deploy and run functions in the application. All the functions in the application are deployed and run on compute instances with the same architecture. The function's image must contain the necessary dependencies for the architecture you select, as follows:

        • Select the Generic_ARM shape if you always want functions in the application to run on compute instances with an Arm-based architecture. If you select this single architecture shape for the application, the function's image must contain the necessary dependencies for the Arm architecture (in either a single architecture image, or a multi-architecture image).
        • Select the Generic_X86 shape if you always want functions in the application to run on compute instances with an x86-based architecture. If you select this single architecture shape for the application, the function's image must contain the necessary dependencies for the x86 architecture (in either a single architecture image, or a multi-architecture image).
        • Select the Generic_X86_ARM shape if you want functions to run on compute instances with whichever architecture has sufficient capacity. In this case, OCI Functions selects the architecture on which to run functions based on available capacity. If you select this multi-architecture shape for the application, every function's image must contain the necessary dependencies for both the Arm architecture and the x86 architecture (in a multi-architecture image).

        Note that you cannot change the application's shape after you have created the application. See Selecting a Single Architecture or Multi-Architecture Application Shape on which to run a Function.

      • Tagging Options: If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option (you can apply tags later) or ask an administrator.
    7. Select one of the following options:

      • To create the application now, click Create. The new application appears in the list of applications.
      • To create the application later using Resource Manager and Terraform, click Save as stack to save the resource definition as a Terraform configuration. For more information about saving stacks from resource definitions, see Creating a Stack from a Resource Creation Page.
  • Using the Fn Project CLI

    Tip

    From time to time, new versions of the Fn Project CLI are released. We recommend you regularly check that the latest version is installed. For more information, see Steps to upgrade the Fn Project CLI.

    To create a new application in OCI 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 OCI 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

    Using the OCI CLI

    Use the oci fn application create command and required parameters to create an application:

    oci fn application create --compartment-id <compartment-ocid> --display-name <app-name> --subnet-ids <subnet-ocids> [OPTIONS]

    For a complete list of flags and variable options for OCI CLI commands, see the Command Line Reference.

  • Run the CreateApplication API operation to create an application.