A comprehensive automation suite for provisioning, configuring, and managing Virtual Machines (Compute Instances) on Oracle Cloud Infrastructure (OCI). This repository streamlines the infrastructure lifecycle using [Insert Tool: e.g., Terraform / Ansible / Python SDK].
- Overview
- Features
- Architecture
- Prerequisites
- Installation
- Configuration
- Usage
- Troubleshooting
- Contributing
- License
This project reduces manual overhead by automating the deployment of OCI Compute resources. It is designed to be modular, secure, and scalable, suitable for both development environments and production workloads.
Key capabilities include:
- Automated VCN and Subnet discovery/creation.
- Dynamic injection of SSH keys and Cloud-Init scripts.
- Attachment of block storage volumes.
- Automatic association with Network Security Groups (NSGs).
- Infrastructure as Code: Fully declarative setup for reproducible environments.
- Multi-OS Support: Supports Oracle Linux, Ubuntu, CentOS, and Windows images.
- Security First: Enforces least-privilege principles via IAM policies and strict Security Lists.
- Custom Bootstrapping: Supports
user_datafor post-provisioning configuration (installing Docker, updates, etc.). - Flexible Scaling: Easily adjust OCPUs and Memory for Flex shapes.
Note: Replace the link below with your actual architecture diagram.
The automation creates the following resources:
- Networking: VCN, Public/Private Subnets, Internet Gateway/NAT Gateway.
- Compute: VM instances using flexible shapes (e.g.,
VM.Standard.E4.Flex). - Storage: Boot volumes and optional attached Block Volumes.
Before running the automation, ensure you have the following:
- Oracle Cloud Account: A generic active OCI account.
- OCI API Keys: An RSA key pair in PEM format for API signing.
- Required Tools:
- [CLI Tool Name, e.g., Terraform v1.0+]
- [CLI Tool Name, e.g., OCI CLI]
- Git
-
Clone the Repository
git clone https://github.com/your-username/OCI-vm-automation.git cd OCI-vm-automation -
Initialize Dependencies If using Terraform:
terraform init
If using Python:
pip install -r requirements.txt
Copy the example configuration file to create your local settings file.
cp examples/terraform.tfvars.example terraform.tfvars
# OR
cp config.example.yaml config.yaml| Variable | Description | Required | Default |
|---|---|---|---|
tenancy_ocid |
The OCID of your tenancy | Yes | - |
user_ocid |
The OCID of the user executing the script | Yes | - |
fingerprint |
Fingerprint for the API signing key | Yes | - |
region |
OCI Region (e.g., us-ashburn-1) |
Yes | us-ashburn-1 |
compartment_id |
Target compartment for resources | Yes | - |
instance_shape |
VM Shape (e.g., VM.Standard.E4.Flex) |
No | VM.Standard.E4.Flex |
ssh_public_key |
Path to your SSH public key | Yes | ~/.ssh/id_rsa.pub |
Preview the changes before applying them to your OCI tenancy.
# Example for Terraform
terraform planProvision the infrastructure.
# Example for Terraform
terraform apply --auto-approveOnce provisioned, the output will display the public IP.
ssh -i ~/.ssh/id_rsa opc@<PUBLIC_IP_ADDRESS>To remove all resources created by this automation:
terraform destroyIssue: 401 Authorization failed
- Cause: Incorrect API Key, Fingerprint, or User OCID.
- Fix: Verify your
~/.oci/configor your environment variables. Ensure the public key is uploaded to the User console in OCI.
Issue: Service Limit Reached
- Cause: Your tenancy has hit the limit for Always Free or standard Compute cores.
- Fix: Request a limit increase in the OCI Console or switch to a paid instance shape.
Issue: Invalid Parameter - ShapeConfig
- Cause: Trying to set memory/OCPU for a non-Flex shape.
- Fix: Only specify memory/cpu config if using E3/E4/A1 Flex shapes.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Project Maintainer - [Your Name] - [your.email@example.com]
Project Link: https://github.com/your-username/OCI-vm-automation