Preinstalling the Oracle Cloud Development Kit

Provision a compute instance with the Oracle Cloud Development Kit preinstalled and ready to use.

What's Included

The Oracle Cloud Development Kit template preinstalls the following Oracle Cloud Infrastructure items on the Compute instance:

Instance principal authorization is set up for installed items and the provisioned Compute instance. An upgrade script is also included.

Steps for Using the Oracle Cloud Development Kit

To provision an instance with the development kit

  1. Launch the Create stack page for the Oracle Cloud Development Kit template by clicking this button:

    Deploy to Oracle Cloud

    Alternative steps from the Console
    1. Open the navigation menu and click Developer Services. Under Resource Manager, click Stacks.
    2. Under List Scope, select a compartment that you have permission to work in. The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

    3. Click Create stack.
    4. In the Create stack page, click Template.
    5. Under Stack configuration, click Select template.
    6. In the Browse templates panel, click Architecture.
    7. Select Oracle Cloud development kit.
      Note

      You might need to go to your home region before the template is available for selection.

      The focus changes back to the Create stack page and the Oracle Cloud Development Kit template is selected.

  2. Follow the prompts to save your new stack and provision the instance
    1. In the Create stack page, enter a Name for the new stack (or accept the default name provided). Avoid entering confidential information.
    2. Optionally enter a Description.
    3. From the Create in compartment drop-down, select the compartment where you want to create the stack.

      A compartment from the list scope is set by default.

    4. 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 or ask an administrator. You can apply tags later.

    5. Click Next.

      The Configure variables panel displays the following variables:

      • Instance Shape: Select the shape you want to use for the Compute instance.
      • Auto-generate SSH key pair: Either generates an SSH key pair or allows you to upload a public key.
        • Enabled (selected): Automatically generates an SSH key pair for accessing the instance. The private key is stored in the Terraform state file. You'll use the private key later to connect to the instance.
          Important

          Do not use this option in production. The Terraform state file containing the private key is visible to anyone with access to the created stack.
        • Disabled (cleared): Allows you to upload a public key. No private key is stored. Keep the corresponding private key in a safe location. You'll use the private key later to connect to the instance.

          For instructions on generating SSH key pairs, see Managing Key Pairs on Linux Instances.

      • Compute instance to access all resources at tenancy level: Controls the level used for the dynamic group policy, which determines what resources are accessible by users of the Compute instance.
        • Enabled (selected): Tenancy level for access to all resources in the tenancy.
        • Disabled (cleared): Compartment level for access to all resources in the same compartment as the instance.
    6. Click Next.

    7. In the Review panel, verify your stack configuration.

    8. Select the check box for Run apply.

      This option automatically provisions the instance on stack creation.

    9. Click Create to create your stack and automatically provision the instance.

      The new stack appears in the Stack Details page. Resource Manager runs the Apply action on the new stack, starting the process to provision the instance.

      The new apply job is listed under Jobs. Monitor its status: "Succeeded" indicates that the job has completed. While the job runs, or after it finishes, you can download its log file.

      Once the instance is provisioned (indicated by a "Succeeded" status for the apply job), installation of the development kit items begins. The installation process takes a few minutes. If you connect to the instance before the installation finishes, then a warning message indicates that the installation is still in process. Once the items are installed on the instance, you can immediately use them.

    10. To view the Terraform state file (shows the state of your resources after running the job), click the name of the apply job and then click View state under Resources.

      Optionally select Show changes in this version.

Congratulations! You have provisioned a Compute instance with the Oracle Cloud Development Kit already installed and ready to use. You can now connect to the instance and use the development kit.

To connect to your newly created instance

Run the following command:

ssh -i <private-key> opc@<compute-instance-public-ip>

<private-key> is the private key associated with the instance you provisioned from the stack created using the Oracle Cloud Developer Tools template.

<compute-instance-public-ip> is the IP address of the instance.

To retrieve the associated private key and IP address
  1. Go to the Stack details page for your newly provisioned instance:
    1. Open the navigation menu and click Developer Services. Under Resource Manager, click Stacks.
    2. Click the name of the stack to display its details page.
  2. Click the Application information tab.
  3. Copy the value for Compute Instance Public IP.
  4. For the private key, follow the steps that correspond to the key option you selected while creating your stack:
    • If you enabled Auto-generate SSH key pair , then retrieve the generated private key: Copy the value for Generated Private Key for SSH Access.
    • If you disabled Auto-generate SSH key pair , then reference the full path and name of the file that contains the private key corresponding to the public key that you uploaded while creating the stack.
      Note

      When you connect to your instance, the private key file permissions are validated. For security, your private key must be accessible by the owner only; otherwise, you won't be allowed to connect to the instance. (Owner write permissions are required for you to add the private key to the file.) For Unix or Linux, use the command chmod 600 (-rw-------).

For general information about connecting to Compute instances, see Connecting to an Instance.

Once connected to your instance, you can use the installed development kit.

To use the installed development kit

See the following examples:

Preconfigured Authorization

Instance principal authorization is set up for installed development kit items and the provisioned compute instance. The template provides the following preconfiguration:

  • A dynamic group
  • An IAM policy, with all resource access determined by stack configuration (either tenancy or compartment level)
  • Environment variables set in .bashrc on the Compute instance for CLI, Terraform, and Ansible

For more information about instance principal authorization, see Calling Services from an Instance.