1Z0-1067-25 Question 14
Select 2You are setting up an ephemeral testing environment in the us-phoenix-1 region using the Ubuntu 20.04 image and the VM.Standard3.Flex shape for your instance. After creating the instance, you need to retrieve its OCID from the CLI output for verification and then terminate the instance once your tests are complete. Which two actions will fulfill these requirements using the OCI CLI?
- A
Use 'oci compute instance launch' with the --query 'data.id' parameter to filter the instance� OCID from the JSON output, then run 'oci compute instance terminate --instance-id
' to remove the instance. - B
Use 'oci compute instance launch' with the --no-wait parameter to skip creation progress messages and pass only the instance display name to 'oci compute instance terminate' to remove it.
- C
Use 'oci compute instance launch' to create the instance, store the output in a variable, parse the OCID with JMESPath query 'data.id', then run 'oci compute instance delete --instance-id
' to remove the instance. - D
Use 'oci compute instance launch' with --wait-for-state RUNNING to create the instance, parse the OCID with 'oci compute instance get --query "data.id"', and then run 'oci compute instance terminate --instance-id
' to remove the instance.
Show answer and explanation
Correct answers: A, D
Explanation
When managing resources with the OCI CLI, it's crucial to use the correct commands and parameters. 'launch' (not 'create') is the proper subcommand for creating an OCI compute instance, and 'terminate' is the correct subcommand for removing it. By using JMESPath queries (e.g., --query 'data.id'), you can filter JSON output to extract just the OCID you need for subsequent operations. Refer to the official OCI CLI documentation for further details: https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cli.htm
- A. Correct.
Correct. 'oci compute instance launch' is the valid command to create a compute instance. Adding '--query "data.id"' filters the JSON output to return only the instance OCID, which can be used immediately with the 'oci compute instance terminate' command to remove the instance.
- B. Incorrect.
Incorrect. The '--no-wait' parameter simply prevents the CLI from waiting for the workflow to complete before returning. It does not allow you to skip referencing the instance OCID. You must provide the instance's OCID, not just the display name, to terminate it.
- C. Incorrect.
Incorrect. The correct command to remove a compute instance is 'terminate', not 'delete'. 'delete' is not recognized when attempting to remove an instance through the CLI.
- D. Correct.
Correct. Using '--wait-for-state RUNNING' ensures the instance is fully launched before retrieving its details. You can then query the instance OCID with 'oci compute instance get --query "data.id"' and invoke 'terminate' to remove it once testing is done.