Environment setup on OCI is the process of creating the foundational infrastructure, security rules, and user permissions that every generative AI application needs before it can run. Without proper setup, your AI model might have no data access, no network connectivity, or worse, a security hole that exposes your work. For the 1Z0-1127 exam, understanding how to configure compartments, policies, networking, and authentication is non-negotiable because it is the first practical task any cloud developer must complete.
Jump to a section
A simple way to picture Environment Setup on OCI
3 distinct keys are needed before you can move into your new apartment: the building key, the flat key, and the mailbox key. Each key grants a specific level of access, just like OCI compartments, users, and policies control who can see and do what in the cloud.
When you first get the keys, you also need to set up the utilities - electricity, internet, and water. For OCI, the equivalent is setting up your Virtual Cloud Network (VCN), subnets, security lists, and internet gateway. Just as you wouldn't move furniture in before the electricity is on, you shouldn't deploy a generative AI model before your network is properly configured.
Finally, you set up the building's security system and decide who gets a fob for the main door versus who just gets a temporary code. In OCI, this is authentication and authorisation: you define IAM policies that say 'this user group can manage compute instances' or 'this service can access object storage'. Without this setup, either nobody can get in (overly restrictive) or anyone can walk in off the street (insecure). The whole process - get the right keys, turn on the utilities, set the rules - is exactly what 'Environment Setup on OCI' means for generative AI development.
Environment setup on OCI (Oracle Cloud Infrastructure) means preparing the cloud space so you can safely and effectively develop, train, and deploy generative AI models. Think of it as building the workshop before you start making furniture. This chapter covers four main pillars: policies, networking, authentication, and compartments.
Let's start with compartments. A compartment is a logical container that groups related cloud resources. For example, you might have one compartment called 'AI-Development' for all your test models and another called 'AI-Production' for models serving real customers. Compartments help you organise resources, apply cost tracking, and enforce security boundaries. Every single resource in OCI - every compute instance, every storage bucket, every AI model - must belong to exactly one compartment.
Next, policies. A policy in OCI is a document written in a simple language that declares who can do what to which resources. For example, a policy might say 'Allow group AIDevelopers to manage ai-service-family in compartment AI-Development'. The word 'manage' means full control - create, read, update, delete. Other verbs include 'use' (read and use but not delete) and 'read' (view only). Policies are written at the tenancy level or within a compartment and they cascade down. If you get the policy wrong, either developers cannot access the models they need, or unauthorised users can tamper with your AI workloads.
Networking is the third major piece. For generative AI, you typically need a Virtual Cloud Network (VCN) - your private slice of the OCI network. Inside the VCN, you define subnets (smaller network segments), security lists (firewall rules that control traffic in and out), and internet gateways (to allow your model to access public APIs or to be accessed by users). For example, a generative AI model that calls the external OpenAI API needs a route from its subnet to an internet gateway. Conversely, a model that only serves internal corporate users might sit in a private subnet with no internet access, connected only through a VPN or FastConnect.
Authentication is what proves you are who you say you are. OCI supports several methods: username and password, API keys (for programmatic access), instance principals (where a compute instance itself has an identity), and federation with external identity providers such as Microsoft Entra ID. For generative AI development, you often use API keys to let your code call OCI AI services like the Generative AI service. You must securely store these keys - never hard-code them in your source code.
Finally, there is Identity and Access Management (IAM). IAM is the umbrella service that manages users, groups, compartments, and policies together. You create users (people or services), put them into groups (like AIDevelopers or AIAdmins), then write policies that assign permissions to those groups. The policy engine evaluates every request - if no policy explicitly allows an action, it is denied by default.
Why does all of this matter for generative AI? Because AI models consume data, produce outputs, and often need to access other cloud services like Object Storage (for training data) or the OCI Data Science service. Without proper environment setup, your model might fail with 'permission denied' errors, your training data might be exposed to the public internet, or your costs might spiral because resources are shared across teams. OCI enforces a 'least privilege' security model by default - meaning resources start with no permissions, and you explicitly grant what is needed. This is opposite to older on-premise systems where everything was open by default.
Setting up an environment correctly also means planning for disaster recovery and compliance. For example, if you are building a healthcare AI chatbot, your compartment might have a policy that prevents any data from leaving the region. This is achieved through network security rules and IAM policies that block egress traffic. The exam expects you to know the exact policy syntax and network components needed for a generative AI workload.
Create Compartments
Log into the OCI Console and create at least two compartments: one for development and one for production. This isolates your generative AI resources so that experiments in dev cannot affect production workloads.
Set Up IAM Users and Groups
Create user accounts for each team member and organise them into groups such as 'AI-Developers' and 'AI-Admins'. This groups users with similar permissions, simplifying policy management.
Write IAM Policies
Define policies that grant the AI-developers group permission to manage ai-service-family resources in the development compartment. Use the 'use' verb for read-and-use access but not delete, ensuring safety.
Configure Networking
Create a VCN with a CIDR block like 10.0.0.0/16. Inside, create at least two subnets: a public subnet (for web interfaces) and a private subnet (for AI compute instances). Attach an Internet Gateway to the public subnet and a NAT Gateway to the private subnet for outbound traffic.
Define Security Lists and NSGs
Configure a security list for the private AI subnet to allow inbound traffic only from the public subnet on the model's API port. Optionally, create an NSG for a specific compute instance that needs unique rules, like allowing SSH from only one IP.
Test Authentication with Instance Principal
Launch a compute instance in the private subnet. Create a dynamic group for the instance and write a policy allowing that dynamic group to read objects from an Object Storage bucket. Deploy a small test script on the instance to verify it can access the bucket without any API key.
An IT professional tasked with setting up an OCI environment for generative AI development follows a structured process. Let's walk through a realistic scenario: a company called 'HealthAssist AI' wants to build a generative AI model that drafts patient follow-up emails from doctor notes.
Step 1: The cloud architect creates a root compartment called 'HealthAssist-Tenancy'. Inside it, they create three child compartments: 'HealthAssist-Dev', 'HealthAssist-Test', and 'HealthAssist-Prod'. This isolates development work from production, so a bug in a development script cannot accidentally delete production patient data.
Step 2: The architect creates IAM groups. A group called 'AI-Engineers' for the development team, and another called 'AI-Admin' for the lead architect. They create users for each team member and add them to the correct group.
Step 3: They write policies. For the AI-Engineers group in the Dev compartment, the policy says: 'Allow group AI-Engineers to manage ai-service-family in compartment HealthAssist-Dev'. For the AI-Admin group, a tenancy-level policy says: 'Allow group AI-Admin to manage all-resources in tenancy'. This gives admins full control while restricting engineers.
Step 4: Networking is configured. They create a VCN with a CIDR block of 10.0.0.0/16. Inside, they create three subnets: a public subnet for the web front-end, a private subnet for the AI model compute instances, and a third private subnet for a database. An internet gateway is attached to the VCN, but only the public subnet has a route to it. The private subnets route traffic through a NAT gateway for outbound internet access (to download model libraries) but are not directly reachable from the internet.
Step 5: Security lists are defined. The public subnet allows incoming HTTPS traffic from the internet. The private AI subnet allows incoming traffic only from the public subnet on port 8080 (the model API port). The database subnet allows incoming traffic only from the AI subnet on port 1521 (Oracle DB). This is a classic three-tier architecture.
Step 6: Authentication for the AI model itself. The developer writing the model code wants it to access an Object Storage bucket containing training data. Instead of hard-coding API keys, they create an instance principal - a special identity assigned to the compute instance. They then write a policy allowing that instance principal to read objects from the bucket. This is more secure than keys.
Step 7: Testing the setup. The developer launches a small test model. If the model can access the data and respond to API requests, the environment is working. Common issues include a missing route rule (the model cannot reach the internet), a policy that is too restrictive (denying access to the AI service), or a security list blocking the API port.
Throughout this process, the IT professional uses the OCI Console (web interface) for initial setup, then switches to the CLI (command line interface) or Terraform (infrastructure as code) for repeatable deployments. They also enable Cloud Logging to audit who did what - crucial for compliance in healthcare.
The 1Z0-1127 exam tests Environment Setup on OCI (objective 6.1) with a heavy emphasis on policy syntax and network architecture for AI workloads. Expect around 8-12 questions from this objective across the exam.
The exam loves to test your ability to read and interpret policy statements. You will see a policy like 'Allow group A to use ai-service-family in compartment B' and then a question: 'What can group A do?' Three common distractors are: 'full management', 'only read', and 'use means read and use but not delete'. The correct answer is always 'use means read and use but not delete'. The verb hierarchy is: inspect < read < use < manage. 'Inspect' is the least permissive (can list resources), 'manage' is full control.
Another favourite topic is compartment hierarchy and policy inheritance. Policies written in a parent compartment automatically apply to child compartments unless overridden by a more restrictive policy. The exam might present a scenario where a policy at the root compartment allows access to all Object Storage, but a child compartment has a deny policy. OCI does not have explicit 'deny' - instead, a lack of 'allow' is the denial. So if the child compartment has no policy granting access, access is blocked even if the parent allows it? Actually no - OCI policies at root tenancy level apply to all compartments. The trick: a more specific policy at a lower level cannot override a tenancy-level policy that grants access. But an administrator can set a policy to 'grant only in specific compartment' by scoping. The exam will test this nuance.
Networking questions focus on security lists vs network security groups (NSGs). Security lists apply to entire subnets; NSGs apply to specific instances. The exam will ask which one to use for fine-grained control over a generative AI model's traffic. Answer: NSG, because you can attach different NSGs to different instances within the same subnet.
Key concepts to memorise:
Four authentication methods: API keys, instance principals, resource principals, federation (including Microsoft Entra ID).
The difference between dynamic groups (for resources like compute instances) and regular groups (for users).
The fact that every OCI resource must belong to exactly one compartment.
The default 'deny all' security model - you must explicitly allow everything.
How to set up a private subnet for AI models that still need outbound internet (via NAT gateway).
The exam also tests 'least privilege' - choosing the correct policy verb. For example, if a generative AI service needs to read training data from Object Storage but never write to it, the correct policy verb is 'read', not 'use' or 'manage'. They will give you a list of verbs and ask for the minimal permission.
Traps to watch:
Confusing 'compartment' with 'tenancy'. A tenancy is your entire OCI account; a compartment is a logical subdivision within it.
Thinking instance principals are for users - they are for resources (virtual machines).
Believing security lists are stateless - they are stateful by default, meaning return traffic is automatically allowed. This is important for AI model APIs where a request comes in on port 80 and the response goes out - you only need to allow the inbound rule.
Forgetting that OCI policies use the format: 'Allow [subject] to [verb] [resource-type] in [location]'. Every question about policy will test this exact structure.
Every OCI resource, including generative AI models, must belong to exactly one compartment, which acts as a logical container for organising and securing resources.
OCI policies use a strict syntax: 'Allow [subject] to [verb] [resource-type] in [location]' where the verb must be one of inspect, read, use, or manage (from least to most permissive).
No policy in OCI can explicitly deny access; access is controlled only by what is allowed, and anything not allowed is denied by default.
A Virtual Cloud Network (VCN) is private by default, so you must create an Internet Gateway and a route table entry to enable internet access for generative AI models.
Instance principals let your compute instance authenticate to OCI services without any stored credentials, making it more secure than API keys in production AI code.
Security lists are stateful firewall rules applied to entire subnets, while Network Security Groups (NSGs) apply to specific instances for more granular control.
These come up on the exam all the time. Here's how to tell them apart.
Security List
Applies to an entire subnet - any instance in that subnet gets the same rules
Stateful by default - return traffic allowed automatically
Best for broad perimeter rules like 'no SSH from internet' for a subnet
Network Security Group (NSG)
Applies to individual instances or a set of instances you define
Also stateful, but can have different rules per instance
Best for fine-grained rules, e.g., 'allow API traffic only to this specific AI model instance'
Regular Group
Contains human users (people)
Used in policies to grant permissions to users
Users are added manually by an administrator
Dynamic Group
Contains resources like compute instances
Used in policies to grant permissions to those resources
Resources are matched based on rules (e.g., all instances in a compartment) automatically
API Key Authentication
Requires generating and storing a private key file
Key must be securely stored and rotated periodically
Suitable for human users or external scripts
Instance Principal Authentication
No keys to store - the instance identity is built into the VM
Automatically rotated when the instance is replaced
Suitable for code running inside OCI compute instances
Public Subnet
Has a direct route to an Internet Gateway
Instances can be assigned public IP addresses
Suitable for web servers or APIs that need public access
Private Subnet
No direct route to an Internet Gateway
Instances cannot have public IP addresses
Suitable for AI models that should not be directly exposed to the internet
Mistake
I can set up the environment once and never touch it again. Policies and networking are static.
Correct
Environment setup is an ongoing process. As you add new AI models, change data sources, or scale, you must update policies, network routes, and security lists.
Beginners often treat cloud setup like installing a desktop application - one-time install and forget. Cloud environments are dynamic and require iteration.
Mistake
A policy at the compartment level can 'deny' access to reduce permissions granted by a root policy.
Correct
OCI has no 'deny' statement. Only 'allow' statements exist. If a root policy grants access, you cannot block that access with a compartment-level policy. The only way to restrict is to not grant 'allow' in the first place, or to use resource-scoped policies at the root level.
This comes from experience with other cloud providers like AWS which have explicit 'Deny' effects. OCI's model is simpler but beginners incorrectly assume a deny capability exists.
Mistake
Instance principals are the same as API keys - they are just another way to authenticate a person.
Correct
Instance principals are identities assigned to a compute instance (a virtual machine), not to a human user. They allow code running on that instance to authenticate to OCI services without storing any credentials. The instance itself is the identity.
The term 'principal' is abstract. Beginners picture a 'principal' as a person (like a school principal), not as a machine entity.
Mistake
Security lists and network security groups (NSGs) are interchangeable - I can use either for any security rule.
Correct
Security lists apply to entire subnets - every instance in that subnet gets the same rules. NSGs apply to individual instances or groups of instances. They serve different purposes: security lists for broad perimeter rules, NSGs for fine-grained per-instance rules.
The names sound similar and both manage firewall rules. Beginners think 'either works' without understanding the architectural difference.
Mistake
When I create a VCN, it automatically has internet access.
Correct
A VCN is private by default. To get internet access, you must explicitly create an Internet Gateway and add a route table entry pointing the default route (0.0.0.0/0) to that gateway. Without this, no instance in the VCN can reach the internet.
This follows the 'default deny' model but feels counterintuitive because most home and office networks have internet access automatically.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
A tenancy is the root of your OCI account - it is the entire organisation. A compartment is a logical container inside the tenancy that groups related resources. You cannot delete a tenancy, but you can create and delete compartments.
No. Policies for users use regular groups (like 'AI-Developers'). Policies for services or compute instances use dynamic groups, which define a set of resources (like all compute instances in a compartment) that can be granted permissions.
Your generative AI model will not be able to access the internet, so it cannot download libraries, call external APIs, or be reached by users outside the VCN. The model can only communicate with resources inside the VCN.
No, never hard-code API keys. Use instance principals or resource principals instead, which allow the compute instance to authenticate without storing credentials. If you must use API keys, store them in OCI Vault (a secret management service).
'Read' permits viewing and listing resources. 'Use' permits everything 'read' does plus the ability to use the resource - for example, invoking an AI model endpoint or using a compute instance. 'Use' does not permit deleting or creating new resources.
No. Once you set up IAM policies at the tenancy or compartment level, the permissions apply to all services within that scope. You do not configure authentication per service; you configure policies that grant access to service families (like 'ai-service-family' or 'object-storage-family').
You've finished Environment Setup on OCI. Continue through the 1Z0-1127 study guide to build a complete picture of the exam.
Done with this chapter?