1Z0-1067-25 exam dumps

1Z0-1067-25 practice question 16 of 138

Oracle Cloud Infrastructure 2025 Cloud Ops Professional. Professional level, Oracle. Free question with the correct answer and a full explanation.

1Z0-1067-25 Question 16

Single answer

You are tasked with launching a temporary compute instance in your development compartment using the OCI CLI. After verifying the instance operations, you want to capture the instance OCID for reference and then terminate the instance immediately. Which sequence of CLI commands correctly accomplishes these steps?

  1. A
    1. oci compute instance launch --compartment-id --display-name MyDevInstance --shape VM.Standard.E3.Flex --subnet-id -assign-public-ip true export MY_INSTANCE=$(oci compute instance launch --compartment-id --query 'data.id') oci compute instance terminate --instance-id MY_INSTANCE --force
  2. B
    1. export INSTANCE_OCID=$(oci compute instance launch --compartment-id --display-name MyDevInstance --shape VM.Standard.E3.Flex --subnet-id --assign-public-ip true --query 'data.id' --raw-output) oci compute instance terminate --instance-id $INSTANCE_OCID --force
  3. C
    1. oci compute instance launch --compartment-id MyDevInstance --display-name --shape VM.Standard.E3.Flex --subnet-id --assign-public-ip true oci compute instance copy --instance-id MyDevInstance --destination-compartment-id oci compute instance terminate --instance-id MyDevInstance --force
  4. D
    1. oci compute instance create --compartment-id --name MyDevInstance --shape VM.Standard.E3.Flex --subnet export INSTANCE=$(oci compute instance get --compartment-id --raw-output) oci compute instance delete --instance-id $INSTANCE
Show answer and explanation

Correct answer: B

Explanation

In OCI CLI, the proper workflow to provision and destroy a resource often involves using a single command to both launch the resource and capture its numeric or textual identifier (OCID). The --query 'data.id' parameter isolates the OCID from the response, while --raw-output ensures no additional JSON formatting. Storing this OCID in an environment variable allows you to target that specific resource later for teardown. Refer to the Oracle Cloud Infrastructure documentation (docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cli.htm) for detailed steps and best practices on CLI usage.

  • A. Incorrect.

    Option 1 is incorrect because it uses two separate instance launch commands: one that does not capture the OCID with --query and another that captures but without --raw-output. Additionally, the environment variable reference MY_INSTANCE is not prefixed with a �$� when terminating, which leads to a potential error.

  • B. Correct.

    Option 2 is correct: It launches the instance in the specified compartment, captures the OCID in an environment variable using --query 'data.id' and --raw-output, and then terminates the instance using the stored OCID. This sequence follows OCI CLI best practices for retrieving and reusing resource IDs.

  • C. Incorrect.

    Option 3 is incorrect: The parameters are mismatched�the instance launch command is referencing compartment and display name incorrectly, and the command 'oci compute instance copy' is not a valid step for simply capturing and terminating an instance in the same compartment.

  • D. Incorrect.

    Option 4 is incorrect: The OCI CLI does not have a command 'oci compute instance create' (the correct subcommand is 'launch'). The subsequent step also incorrectly pulls instance data with 'oci compute instance get' and references it as an entire JSON output with --raw-output, which doesn�t properly capture the instance ID.

Timed practice exam

Take a 1Z0-1067-25 practice test under exam conditions

60 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam