Set up a productive local OCI development workflow using CLI and SDK instead of the web console.
Use when the OCI Console is too slow, setting up CLI profiles, or building shell aliases for common operations.
Trigger with "oci local dev", "oci cli setup", "oraclecloud dev workflow", "avoid oci console".
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Set up a productive local OCI development workflow using CLI and SDK instead of the web console.
Use when the OCI Console is too slow, setting up CLI profiles, or building shell aliases for common operations.
Trigger with "oci local dev", "oci cli setup", "oraclecloud dev workflow", "avoid oci console".
allowed-tools
Read, Write, Edit, Bash(pip:*), Bash(oci:*), Grep
version
1.7.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
["saas","oraclecloud","oci"]
compatibility
Designed for Claude Code
Oracle Cloud Local Dev Loop
Overview
The OCI web console is slow, hard to navigate, and requires dozens of clicks for common operations. A local dev workflow using the OCI CLI and Python SDK replaces the console for everything: listing resources, launching instances, managing object storage, and checking service health. Profile switching lets you target dev/staging/prod from the same terminal.
Purpose: Set up a complete local OCI development environment with CLI profiles, shell aliases, environment variable management, and common workflow scripts that eliminate the need for the web console.
Prerequisites
Completed oraclecloud-install-auth โ valid ~/.oci/config with at least one profile
Python 3.8+ with pip install oci oci-cli
Bash or Zsh shell
OCIDs for your compartments (Governance > Compartments in the Console โ last time you need it)
Instructions
Step 1: Install and Verify the OCI CLI
pip install oci-cli
# Verify installation
oci --version
# Quick connectivity test
oci iam region list --output table
Step 2: Set Up Multiple Profiles
Edit ~/.oci/config with profiles for each environment:
Switch profiles with the --profile flag or OCI_CLI_PROFILE env var:
# CLI flag
oci compute instance list --compartment-id <OCID> --profile dev
# Environment variable (applies to all commands in session)
export OCI_CLI_PROFILE=dev
oci compute instance list --compartment-id <OCID>
Step 3: Environment Variables and .env File
Create a project .env file for compartment OCIDs and region defaults:
# Upload a file
oci os object put --bucket-name my-bucket --file ./data.csv --name data/input.csv
# Download a file
oci os object get --bucket-name my-bucket --name data/input.csv --file ./downloaded.csv
# List objects with prefix
oci os object list --bucket-name my-bucket --prefix "data/" \
--query "data[*].{Name:name,Size:size}" --output table
# Bulk upload a directory
oci os object bulk-upload --bucket-name my-bucket --src-dir ./upload/ --overwrite
Step 6: Python SDK Local Dev Script
Create a reusable dev helper:
#!/usr/bin/env python3"""oci_dev.py โ Local OCI development helper."""import oci
import os
import sys
defget_config(profile="DEFAULT"):
"""Load OCI config with environment variable overrides."""
config = oci.config.from_file("~/.oci/config", profile_name=profile)
# Allow env var override for compartment
config["compartment_id"] = os.environ.get(
"OCI_COMPARTMENT_ID", config.get("tenancy")
)
oci.config.validate_config(config)
return config
deflist_instances(config):
compute = oci.core.ComputeClient(config, timeout=(10, 30))
instances = compute.list_instances(
compartment_id=config["compartment_id"]
).data
for inst in instances:
print(f"{inst.display_name:<30}{inst.lifecycle_state:<12}{inst.shape}")
return instances
deflist_buckets(config):
os_client = oci.object_storage.ObjectStorageClient(config, timeout=(10, 30))
namespace = os_client.get_namespace().data
buckets = os_client.list_buckets(
namespace_name=namespace,
compartment_id=config["compartment_id"]
).data
for b in buckets:
print(f"{b.name:<40}{b.time_created}")
return buckets
defhealth_check(config):
identity = oci.identity.IdentityClient(config, timeout=(5, 15))
user = identity.get_user(config["user"]).data
regions = identity.list_regions().data
print(f"User: {user.name}")
print(f"Regions: {len(regions)} available")
print("Status: OK")
if __name__ == "__main__":
profile = os.environ.get("OCI_CLI_PROFILE", "DEFAULT")
cfg = get_config(profile)
cmd = sys.argv[1] iflen(sys.argv) > 1else"health"if cmd == "instances":
list_instances(cfg)
elif cmd == "buckets":
list_buckets(cfg)
elif cmd == "health":
health_check(cfg)
else:
print(f"Usage: python oci_dev.py [instances|buckets|health]")
With your local dev loop set up, see oraclecloud-sdk-patterns for production-grade client patterns, or oraclecloud-common-errors when you hit issues during development.