Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

Using Ephemeral OS Disks in Azure for Stateless VMs

Azure OS Disks serve as the primary storage for Azure Virtual Machines. Persistent disks provide reliability and robust backup guarantees for stateful VMs, but these disks cost money. If your VM is stateless, however, you can use an ephemeral OS disk, which has no additional storage cost beyond the base compute cost of the VM itself. These ephemeral disks can also be deployed and reimaged more quickly than persistent disks. In this lab, you will have the opportunity to experiment with ephemeral OS disks by building and reimaging a stateless VM.

Azure icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 30m
Published
Clock icon Feb 14, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create the stateless VM.

    1. Log in to the Azure Portal.

    2. Click + Add and add a new Ubuntu Server.

    3. Enter ephemeral-disk-poc for the Virtual machine name.

    4. Select Ubuntu Server 18.04 LTS for the Image.

    5. Click Change size, then select DS1_v2 and click Select.

    If you want to log in using a password, select Password for Authentication type, then supply a username and password. Be sure you remember the password so you can log in later.

    1. Under Disks, click Advanced. Select Yes for Use ephemeral OS disk.

    2. Click Review + create, then Create.

    Wait a few minutes for your VM deployment to finish.

  2. Challenge

    Reimage the VM.

    1. Go the Azure portal. Navigate to your resource group and click on the ephemeral-disk-poc VM. You should see a Public IP Address. Use this, along with the credentials you created earlier, to log in to the VM.

    2. Create some test data in the home directory:

    echo "Hello, World!" > test.txt
    
    1. Verify that the file exists. You should see test.txt listed:
    ls
    
    1. In the Azure portal, navigate to the ephemeral-disk-poc VM.

    2. Click the Reimage button and confirm. Wait a few moments for the reimaging to complete.

    If you still have your ssh session open, it will be closed as the VM shuts down. The newly-imaged VM will have a new host key, which may result in an error if you attempt to log in again. You can avoid this by removing the old host key from your known_hosts file.

    1. Replace <public IP of the VM> with the actual public IP of your VM:
    ssh-keygen -R <public IP of the VM>
    
    1. Log in to the vm again. Check for the test.txt file again. This time, the file will not be present, since the VM has been returned to a clean state.
    ls
    

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans