Executing Shutdown Script on a GCE VM | Scribe

    Executing Shutdown Script on a GCE VM

    • Hafeez Baig |
    • 11 steps |
    • 38 seconds
    • Google CloudGoogle Cloud
    1
    Sign in into the **Google Cloud Console**
    2
    Type "**VM instances**" in the search bar and click on the **VM instances** option
    information ordinal icon
    **What are VM instances?**\ \ **VM instances** in Google Cloud Platform (GCP) refer to **virtual machines** that run on Google Compute Engine. These are customizable compute resources that provide users with the capability to run applications, deploy workloads, and manage services on Google's infrastructure. VM instances can be configured with different CPU, memory, and storage options, and can run various operating systems, including Linux and Windows. They are a key component of cloud infrastructure, offering scalable and flexible computing power.
    3
    **VM instances** wizard will open, click on the **CREATE INSTANCE** button.
    4
    The **Create an instance** wizard will open. Enter the Name as **instance-2**.
    5
    Navigate to the **Advanced** section by selecting it from the left-hand sidebar.
    6
    In the **Advanced** section, scroll to the **Startup script** section. Here, you can provide an automation script for your VM instance. **Note:** We are just exploring the options, so we will proceed without adding a startup script.
    information ordinal icon
    **What is Startup script ?**\ \ A **startup script** in Google Cloud Platform (GCP) is a script that is automatically executed when a virtual machine (VM) instance is launched. It can be used to install software, configure the environment, or run commands necessary for the instance to function properly. Startup scripts can be written in languages like Bash or Python and are typically defined in the VM instance’s metadata. This automation helps streamline the setup process when provisioning new VMs.
    7
    Scroll down to the **Metadata** section, then click on the **ADD ITEM** button.
    information ordinal icon
    **What is Metadata?**\ \ **Metadata** in Google Cloud Platform (GCP) refers to key-value pairs that provide information about your resources, such as VM instances. It can include details like instance configuration, project-level settings, and custom user-defined data. Metadata is often used to store information like startup scripts, SSH keys, or application-specific configurations that the instance can access while running. GCP provides both **project-level** metadata (applied to all instances in a project) and **instance-level** metadata (specific to individual VMs).
    8
    Enter [[Key 1]] as **shutdown-script**.
    9
    In the **Value 1** field, you can add the value for the shutdown script. **Note:** As we are just exploring the options, we are not adding any value. Make sure not to leave it empty or delete the key-value pair.
    10
    If you want to add multiple keys, you can click on the **ADD ITEM** button. **Note:** We are just exploring the options, so we will proceed. However, make sure to delete any incomplete key-value pairs before clicking the **Create** button; otherwise, the VM creation will fail.
    11
    Scroll the page and click on the **CREATE** button to apply the changes.
    information ordinal icon
    Congratulations! on completing this lab and Understanding Execting Shutdown Script on GCE VM