Jian
Jian

Reputation: 31

how to run a Initialization Script to create vm in the oracle oci java sdk

In the Oracle OCI web console, when you try to create a new compute instance, the console allows you to upload a Initialization Script to run some of the setup command automatically. how to achieve the same benefit from the oci java sdk?

Upvotes: 1

Views: 1291

Answers (1)

Joe
Joe

Reputation: 2540

When you create an OCI VM, you can set its metadata to include an initialization script. Take a look at the example on how to set instance metadata as part of instance launch here. To specify an initialization script as part of the metadata, you'll want to set the key user_data in the metadata, with the value described as mentioned here (see "user_data" section).

Upvotes: 2

Related Questions