Read Time:1 Minute, 26 Second
Oracle Cloud Infrastructure Cloud Shell is VM that runs inside OCI -to be used for manipulating OCI resources using various means, including OCI CLI, Terraform and Ansible. We may want to be able to get files into Cloud Shell – scripts, source code, Infrastructure as Code and more. There are many ways in which we can these files into Cloud Shell. Let me quickly sum up a few that come to mind:
- create a file inside Cloud Shell, open it using an editor such as vi or nano and paste in the contents
- commit the file to a Git Repo and clone the repo to the Cloud Shell
- put the file on OCI Object Storage and download said file using OCI CLI: oci os object get -bn <bucket name> –name <object name> –file <download-as-file-name>
- put the file on OCI Object Storage, create a pre-authenticated request and use the URL in a curl or wget operation in Cloud Shell to download the file
- put the file on a public site (Dropbox, OneDrive, Google Drive) and download the file from there
- put the file in a Docker Container, push the container image to a Container Registry, pull the image into Cloud Shell, start a container and docker cp the files from the container to the Cloud Shell host storage
- create a REST API (for example using Node) to which files can be uploaded – and will be saved locally by the web application; then use ngrok to create a public endpoint that links up with the REST API and post files to this endpoint. They are forwarded through the ngrok public cloud to the application running locally on Cloud Shell and saved on the Cloud Shell storage
4 thoughts on “(Many ways) How to upload files into Oracle Cloud Infrastructure – Cloud Shell”
Try the new file upload/download capability in Cloud Shell. Access this new feature from the Cloud Shell menu.
Does it support a 40GB full stack image of Amazon EC2 to OCI – VM?
Can I copy a file on cloud shell into my compute instance (Oracle cloud) ? If so please advice me how can I do it. I can connect to my compuye instance from cloud shell using ssh.
I checked with my colleague Jeffrey and he shared with me this information:
If you can login through ssh from cloud shell to your server, then it should be possible to copy a file from the cloud shell file system to the VM over scp. For example:
scp file.txt firstname.lastname@example.org:/remote/directory/newfilename.txt
kind regards, Lucas