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.
- Go to https://cloud.oracle.com/identity/domains/my-profile/api-keys
- Click on
Add API Key - Download the private key
- Click on
Add - Either fill the .env file with the content of the config file, or use the config file directly as described below
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_REGIONOCI_USER_IDOCI_TENANCY_IDOCI_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 15 minutes
go run . -t=15
./oci-instance-go -t=15In 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 15 minutes
./oci-instance-go -t=1 5git 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