1. Isolated Workspaces for AI Projects Using OCI Compartments

    Python

    Creating isolated workspaces for AI projects in Oracle Cloud Infrastructure (OCI) can be achieved by utilizing OCI Compartments, which act as a logical container to organize and isolate your cloud resources. Within compartments, you can create various cloud resources like virtual cloud networks (VCNs), compute instances, and AI services that are neatly organized and separated from other compartments.

    To set up this environment, you would also want to create projects within the AI services like Oracle Cloud Infrastructure Data Integration or AI Anomaly Detection, specifically dedicated to your AI workloads.

    Below is a Pulumi program in Python that demonstrates how to create:

    1. An OCI Compartment for an AI workspace.
    2. A Virtual Cloud Network (VCN) and Subnet within the compartment.
    3. An OCI Data Integration Workspace within the compartment.
    4. An AI Anomaly Detection Project within the compartment.

    This infrastructure ensures that all the resources for your AI project are contained within a single compartment, providing isolation from other projects.

    import pulumi import pulumi_oci as oci # Configurations compartment_description = "Compartment for AI project" vcn_cidr_block = "10.0.0.0/16" subnet_cidr_block = "10.0.1.0/24" data_integration_workspace_description = "Workspace for data integration tasks" ai_project_description = "Project for AI anomaly detection" # Create a new OCI compartment ai_compartment = oci.identity.Compartment("aiCompartment", description=compartment_description, name="AIProjectCompartment" ) # Create a Virtual Cloud Network within the compartment vcn = oci.core.Vcn("vcn", compartment_id=ai_compartment.id, display_name="AIProjectVCN", cidr_block=vcn_cidr_block ) # Create a subnet within the VCN subnet = oci.core.Subnet("subnet", compartment_id=ai_compartment.id, vcn_id=vcn.id, display_name="AIProjectSubnet", cidr_block=subnet_cidr_block ) # Create a Data Integration Workspace data_integration_workspace = oci.data_integration.Workspace("dataIntegrationWorkspace", compartment_id=ai_compartment.id, display_name="DataIntegrationWorkspace", description=data_integration_workspace_description, vcn_id=vcn.id, subnet_id=subnet.id, dns_server_ip="8.8.8.8" # Example DNS, replace with suitable value ) # Create an AI Anomaly Detection Project ai_anomaly_detection_project = oci.aianomalydetection.Project("aiAnomalyDetectionProject", compartment_id=ai_compartment.id, display_name="AIAnomalyDetectionProject", description=ai_project_description ) # Export the Compartment OCID and other resources as stack outputs pulumi.export("compartment_id", ai_compartment.id) pulumi.export("vcn_id", vcn.id) pulumi.export("subnet_id", subnet.id) pulumi.export("data_integration_workspace_id", data_integration_workspace.id) pulumi.export("ai_anomaly_detection_project_id", ai_anomaly_detection_project.id)

    In this program:

    • We begin by setting up some configurations as strings. These will be used to describe resources like compartments and VCNs.
    • The oci.identity.Compartment resource creates a new compartment for our AI workspace. The compartment acts as a container for grouping related resources.
    • oci.core.Vcn sets up a Virtual Cloud Network which is essential for defining a network space for your cloud resources.
    • We then create a subnet within the VCN using the oci.core.Subnet resource. The subnet is a subdivision that can be used to segment the network and organize resources.
    • The oci.data_integration.Workspace resource is an OCI Data Integration service workspace specific to data-oriented tasks in AI projects.
    • An AI Anomaly Detection project is set up with the oci.aianomalydetection.Project resource, which relates to the AI Anomaly Detection service in OCI for building AI models.

    Finally, we use pulumi.export to output the identifiers for the created resources, which could then be used to reference these resources in other Pulumi programs or to retrieve the OCID (Oracle Cloud Identifier) when needed.

    This setup ensures a clean, isolated, and dedicated environment for AI projects in OCI, providing a solid foundation for building and managing AI applications.