A golang port of https://github.com/hitrov/oci-arm-host-capacity
This script will attempt to automatically create an instance in oracle cloud infrastructure according to the config in the .env
file.
Follow the same configuration guide in here and populate the .env
file accordingly.
I have also added support for the default configuration provider from the official GO sdk. If you have the
config file and private key in their default location of $HOME/.oci/config
, then you do not need to populate the following 4 fields:
OCI_REGION
OCI_USER_ID
OCI_TENANCY_ID
OCI_KEY_FINGERPRINT
You can set the script to run forever with the specified delay in minute using the -t
flag.
# run one time and end
go run .
./oci-instance-go
#retry every 1 minute
go run . -t=1
./oci-instance-go -t=1
In the release page, download the binary for your OS and platform. Then run the binary
and the .env
file in the same folder.
# run one time and end
./oci-instance-go
#retry every 1 minute
./oci-instance-go -t=1
git clone https://github.com/aattwwss/oci-instance-go.git
cd oci-instance-go
cp /path/to/.env .
go run .
As GO allows you to compile the program into an executable, we run the executable with the .env
file anywhere within the same platform.
git clone https://github.com/aattwwss/oci-instance-go.git
cd oci-instance-go
cp /path/to/.env .
go build .
./oci-instance-go