- Lab
- A Cloud Guru
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.
Path Info
Table of Contents
-
Challenge
Create the stateless VM.
-
Log in to the Azure Portal.
-
Click + Add and add a new
Ubuntu Server
. -
Enter
ephemeral-disk-poc
for the Virtual machine name. -
Select
Ubuntu Server 18.04 LTS
for the Image. -
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.-
Under
Disks
, click Advanced. Select Yes forUse ephemeral OS disk
. -
Click Review + create, then Create.
Wait a few minutes for your VM deployment to finish.
-
-
Challenge
Reimage the VM.
-
Go the Azure portal. Navigate to your resource group and click on the
ephemeral-disk-poc
VM. You should see aPublic IP Address
. Use this, along with the credentials you created earlier, to log in to the VM. -
Create some test data in the home directory:
echo "Hello, World!" > test.txt
- Verify that the file exists. You should see
test.txt
listed:
ls
-
In the Azure portal, navigate to the
ephemeral-disk-poc
VM. -
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.- Replace
<public IP of the VM>
with the actual public IP of your VM:
ssh-keygen -R <public IP of the VM>
- 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
-
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.