Configure a Step to Execute an Object Storage Script

You can configure a user-defined step to execute a script that resides in Object Storage. The script type and format must comply with all the script type and format restrictions.

For a list of script type and format restrictions, see Limitations and Considerations.
Scripts that exit with a non-zero code are considered to have failed and will result in the user-defined step failing execution.
Note

The script or the archive file must be present in the Object Storage Bucket in the standby region.
  1. Select the Run object storage script option.
  2. Select the Region in which the instance currently resides.
    Note

    When selecting the region for the instance, you must ensure that the instance is currently located in the selected region. Even if the step runs after the instance relocates to another region, the selected region must match the current region of the instance.
  3. Select the compartment in which the Target instance exists.
  4. Select the Target instance. This is the instance on which the script resides and will be executed.
    Note

    If the Target instance is in a private subnet, ensure to set up a NAT Gateway. See Setting Up a NAT Gateway for more information.
  5. Select the compartment where the Object storage bucket exists.
  6. Select the Object storage bucket that contains the Script or the Archive.
  7. Select the Object (Which can be an executable script or an archive folder).
  8. Enter the Script and Script Parameters

    Enter the complete command including any required parameters as follows:

    1. python <script.py> <param1> <param2>
    2. <script.sh> <param1> <param2> <param3>

    If the script is part of an archive folder, then provide the relative path to the file within the archive structure that is relative to the root of the archive and do not include the archive directory name itself in the path. When you provide an archive folder as an object, the OCA/Runcommand plugin downloads and unzips the archive onto the instance.

    For example,
    • Scripts.zip ->(unzipped) Scripts -> script1.py

      In this case, enter the following command:

      python script1.py <param1> <param2>.

    • Scripts.zip ->(unzipped) Scripts -> app -> app01 -> script1.py

      In this case, enter the following command:

      python app/app01/script1.py <param1> <param2>.

  9. Optionally, provide a Run as user to execute the script using a user ID that is different from the default user ID ocarun. For example, provide root as the Run as user to run the script as the root user.
    Note

    The Run as user option is not supported on a Windows instance. However, the Run as user option is supported on a Linux instance.
  10. Provide a timeout value for the step.
  11. Enable the toggle to enable the step. Disable the toggle to add the step while keeping it disabled.
  12. Click Add Step to finish adding the user-defined group and step.