Web server using Azure Virtual Machine
Basic example of an Azure web server accessible over HTTP
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set azure-ts-webservercd pulumi-examples/azure-ts-webserverThis example provisions a Linux web server in an Azure Virtual Machine and gives it a public IP address.
Prerequisites#
Deploying the example#
-
Create a new stack:
Terminal window pulumi stack init dev -
Configure the deployment. The username and password here will be used to configure the Virtual Machine. The password must adhere to the Azure restrictions on VM passwords. The
--secretflag ensures your password is encrypted safely.Terminal window pulumi config set azure-native:location westus # any valid Azure region will dopulumi config set username webmasterpulumi config set password --secret <your-password> -
Log in to the Azure CLI (you will be prompted to do this during deployment if you forget this step):
Terminal window az login -
Install dependencies:
Terminal window npm install -
Deploy the stack:
Terminal window pulumi upPreviewing changes:...Performing changes:...info: 7 changes performed:+ 7 resources createdUpdate duration: 2m38s -
Check the IP address:
Terminal window pulumi stack output ipAddress40.112.181.239
Cleaning up#
Once you’re finished experimenting, tear down your stack’s resources by destroying and removing it:
pulumi destroypulumi stack rm