Preinstalling the Oracle Cloud Development Kit
Provision a compute instance with the Oracle Cloud Development Kit preinstalled and ready to use.
The Oracle Cloud Development Kit template preinstalls the following Oracle Cloud Infrastructure items on the Compute instance:
- Command Line Interface (CLI)
- Terraform Provider
- Ansible (includes OCI Ansible modules)
- The following SDKs:
- Git: Use the provided Git command line tool to access any Git-related version control systems, such as Bitbucket, GitHub, and GitLab.
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
Launch the Create stack page for the Oracle Cloud Development Kit template by clicking this button:Alternative steps from the Console
Choose a compartment that you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.
- Click Create stack.
- In the Create stack page, click Template.
- Under Stack configuration, click Select template.
- In the Browse templates panel, click Architecture.
- 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.
Follow the prompts to save your new stack and provision the instance
- In the Create stack page, enter a Name for the new stack (or accept the default name provided). Avoid entering confidential information.
- Optionally enter a Description.
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.
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 are not sure whether to apply tags, skip this option (you can apply tags later) or ask your administrator.
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.
- 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.
- 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.
In the Review panel, verify your stack configuration.
Select the check box for Run apply.
This option automatically provisions the instance on stack creation.
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 completes, 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.
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’ve 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.
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.
- Go to the Stack details page for your newly provisioned instance:
- Click the name of the stack to display its detail page.
- Click the Application information tab.
- Copy the value for Compute Instance Public IP.
- 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.
See the following examples:
- CLI: See Using the CLI
Usage: See Easy Provisioning, CLI Updates
- Terraform Provider
Usage: See Terraform Provider.
- Ansible (includes OCI Ansible
Usage: See Writing a Sample Playbook.
Usage: See Concepts.
Setup and usage: See Client-Side Encryption.
Setup and usage for open source SDKs: See Open Source SDKs
- Git: Use the provided Git command line tool to access any Git-related version
control systems, such as Bitbucket, GitHub, and GitLab.
Usage: To get help on using Git, access the terminal on your new Compute instance and run
- Connect to the instance that you provisioned from the Oracle Cloud development kit template.
- Run the upgrade
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
.bashrcon the Compute instance for CLI, Terraform, and Ansible
For more information about instance principal authorization, see Calling Services from an Instance.