Tools made on Oracle Cloud Infrastructure
Introduction
Gaining secure, auditable access to cloud resources is critical for operations and compliance. The Oracle Cloud Infrastructure (OCI) Bastion Service provides a robust method for secure SSH connectivity, eliminating direct access to private networks. However, manually navigating the OCI Console in order to configure sessions is not practical, especially for those who need frequent access to many instances throughout the day.
To streamline this process, I’ve created the OCI Bastion Session Connector. This is a lightweight, interactive Python tool that brings one click access to your OCI Bastion workflows, right from the terminal.
Why Build on Oracle Cloud Infrastructure?
One of the standout strengths of OCI is its comprehensive and well documented software development kit (SDK) ecosystem. Whether you work in Python, Javascript, Go, or other supported languages, Oracle’s SDKs provide programmatic access to virtually every OCI resource.
This unified API approach allows developers to:
- Automate repetitive tasks
- Build robust custom tools like the OCI Bastion Session Connector
- Integrate cloud operations into CI/CD pipelines and management platforms
In this project, the OCI Python SDK enables complete management of bastion sessions and SSH connectivity, demonstrating how easy it can be to unlock OCI’s full potential from the command line.
What is OCI Bastion Session Connector?
The OCI Bastion Session Connector is designed to make the OCI Bastion service straightforward and accessible. There’s no need to log into the OCI Console or manually build SSH commands. Just configure the script once and connect seamlessly to your target instances through Bastion, all through the command line.
Key Features:
– No Console Required: Establish secure SSH sessions without console navigation.
– Multiple Targets: Manage and connect to multiple instances via a single script.
– Clipboard Integration: SSH command is automatically copied, simply paste to connect!
– Flexible Configuration: Easily specify bastion, target instances, and select SSH user/keys.
Why Use This Tool?
Oracle’s managed bastion service is ideal for secure connectivity, but frequent console logins and manual command setup can slow down workflows. With the OCI Bastion Session Connector, developers and administrators can quickly and securely access cloud instances with minimal friction, directly from their local terminal environments.
Getting Started

Prerequisites
- An existing OCI Bastion in your target subnet.
- OCIDs for your bastion and target compute instances.
- SSH key pair for connection.
Configuration Steps
1. Edit Variables in the Python Script:
- TARGET_SERVERS: Replace with the OCIDs of your target instances / VMs (add as many as needed).
- BASTION_OCID: Set as the OCID of a bastion you created.
- DEFAULT_SSH_USER: Specify the SSH user (default is `opc` for Oracle Linux, `ubuntu` for Ubuntu).
- PUBLIC_KEY_PATH / PRIVATE_KEY_PATH: Supply the local paths to your SSH keys.
2. Python Environment Setup:
Create a virtual environment, activate the environment, and install dependencies.
python3 -m venv bastion_env source bastion_env/bin/activate pip install -r requirements.txt
3. Run the python script
python3 bastion_session_creator.py

As shown above, the script guides you through instance selection and prepares an SSH command for you, copied right to your clipboard!
Troubleshooting Tips
Network Access: Ensure port 22 ingress is allowed from bastion to the instance.
Service Plugins: Enable the bastion service agent plugin. If enabled post-creation, verify related configurations.
Moving Ahead
Explore and contribute: OCI Bastion Session Connector on GitHub
Whether you’re working across multiple cloud instances or seeking to harden your cloud access posture, the OCI Bastion Session Connector helps you harness the full security of OCI Bastion with greater speed and efficiency.
— –
Interested in cloud automation and security on OCI? Check out our best in class security benefits. Share your feedback or enhancements on GitHub, and stay tuned for more open-source tools from the OCI community!
