Tagged COMMAND LINE INTERFACE

Creating Route Rule for Oracle OCI VCN Remote Peering : InvalidParameter – routeRules[0].networkEntityId may not be null


Problem:

When creating a route rule for VCN remote peering between 2 Virtual Cloud Networks in different regions in Oracle OCI using the web console, the UI does not provide a way for selecting the DRG:

routedrg

Solution:

Create the route rule with the CLI as follows:

oci network route-table create --compartment-id xxx --vcn-id yyy --route-rules '[{"cidrBlock":"10.1.0.0/16","networkEntityId":"zzz"}]'

where:
xxx is the OCID of the compartment in which you want to create the route rule
yyy is the OCID of the VCN in which you are creating the route rule for peering
zzz id the OCID of the DRG

Example:
oci network route-table create --compartment-id ocid1.compartment.oc1..aaaaaaaa3sz43qrfhsjmbibsrc6e7c2ftlt53gfnzifvlow2yoz7hk3ni2jq --vcn-id ocid1.vcn.oc1.eu-frankfurt-1.aaaaaaaaukr3nzw44idcp2o75xzyt5nm6y2bvm5gtdg422p47av3knraggcq  --route-rules '[{"cidrBlock":"10.1.0.0/16","networkEntityId":"ocid1.drg.oc1.eu-frankfurt-1.aaaaaaaafv4gkcdwyywxuzuh4izwehvttpvuvmvmaxlpdgg2berpsjkl5ivq"}]'

Hope it helps 🙂

BucketNotEmpty – Bucket named ‘xxxx’ is not empty. Delete all objects first


bucketdelete

Oracle OCI object storage “buckets” can’t be deleted from OCI dashboard unless they are empty… and no empty option menu exists at all (at least at the time of this post).

Anyway, you can do it using the CLI… Follow these steps:

If you don’t have OCI CLI installed follow this post

oci os object bulk-delete-ns <identitydomainname>  -bn <bucketname> 
oci os bucket delete --bucket-name <bucketname>

Hope it helps! 😉

 

Containerizing​ Oracle Cloud Infrastructure (OCI) Command Line Interface (CLI)


Oracle Cloud Infrastructure (OCI) command line interface (CLI) is one of several methods provided for managing the Oracle cloud infra generation 2.

The CLI can be installed and configured in your local machine just following the instructions in the documentation.

In this post, we are explaining an alternate method for using the CLI by means of creating a container. Main advantage: portability and encapsulation of configurations just in case you are managing more than one tenant.

STEP 1

Install and configure OCI CLI. Please notice that a hidden folder called .oci gets created in your home directory:

ocloudshell1

STEP 2

Create a directory for creating the container, let’s call it ocloudshell for instance:

mkdir ocloudshell

STEP 3

copy ./oci directory in your home directory to ocloudshell dir

STEP 4

Edit the ./oci/config file and change the absolute paths to be relative to the home directory. For instance, in my mac is as follows:

ocloudshell2

ocloudshell3

STEP 5

Download the OPC CLI and put it in the ocloudshell dir

STEP 6

Create Dockerfile as follows:

FROM store/oracle/serverjre:8
ENV LC_ALL=en_US.utf8 \
LANG=en_US.utf8
ARG OPC_CLI_VERSION=18.1.2
ENV OPC_CLI_PKG=opc-cli-$OPC_CLI_VERSION.zip
WORKDIR /ocloudshell/
RUN curl -o /etc/yum.repos.d/public-yum-ol7.repo http://yum.oracle.com/public-yum-ol7.repo \
&& yum-config-manager --enable ol7_developer_EPEL \
&& yum-config-manager --enable ol7_developer \
&& yum -y install unzip python-oci-cli \
&& rm -rf /var/cache/yum/*
WORKDIR /root
ADD .oci/ .oci/
RUN chmod 400 .oci/config
RUN chmod 400 .oci/oci_api_key.pem
CMD ["/bin/bash"]

STEP 7

Create the container and push it to a private repository!*
docker build -t myrepo/ocloudshell .

docker push myrepo/ocloudshell
(*) Don’t push the image to a public repo for obvious security reasons

 

TEST IT

So far, so good. Let’s test the container executing a command, here is the command reference documentation. For instance, let’s execute a command for starting a VM:

docker run -it javiermugueta/ocloudshell oci compute instance action --instance-id ocid1.instance.oc1.eu-frankfurt-1.abtheljtbocj2w4qywieacalgsortabg4kep77lplqfwfmlup77725rvsjxa --action start

That’s all folks!

Enjoy 🙂