GithubHelp home page GithubHelp logo

ardacetinkaya / terraform-azure-vm-scale-set Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 31 KB

Basic terraform demo to develop Azure VM Scale Sets resources as backend pool for Azure Front Door.

License: Apache License 2.0

HCL 100.00%
terraform azure-front-door azure-vm-scale-sets azure-loadbalancer multi-region azure

terraform-azure-vm-scale-set's Introduction

Azure VM Scale Sets with terraform example

Basic terraform example for Azure VM Scale Sets with Azure Front Door to understand terraform properties for multi-region application.

Scenario: We have two VMs as Azure VM Scale Sets instances for our business application. Azure Front Door have a backend pool that contains these VMs. If the VM instance in one region fails, Azure Front Door handle the requests with other region. This is just a simple terraform example so some additional commands are needed to be executed in the scale set instance to do some test. In real-life scenario, pre-build VM Images with applications should be used.

image

Provision Azure resources

  • Check terraform.tfvars file, update required Azure Service Principal values and VM info.
  • Run following terraform commands in order
terraform init
terraform plan
terraform apply -auto-approve

Test

There are two VMs as jump-box per region to connect VM Scale Sets instance. From that jump-boxes, we need to RDP to VM Scale Sets instances.

In this example, IIS's default page mocks an application. So, first IIS should be installed in VM instance.

  • Get scale set instances' Windows features
Get-WindowsFeature | where{$_.InstallState -eq "Installed"}
  • Install Web-Server(a.k.a IIS) windows feature to VM Scale Set instance to do some test
Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -IncludeManagementTools
  • Check localhost
Invoke-WebRequest -Uri 127.0.0.1 -UseBasicParsing
  • Check connectivity in scale set instance
Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing
  • Change default IIS Page's content; this is for to observe application in other region
Set-Content -Path C:\inetpub\wwwroot\iistart.htm -Value "Hello World - Region 01/02"
  • Try stoping and restarting IIS in VM Scale Sets instance per regions and observe the output.
iisreset /stop
iisreset /start

Resources

terraform-azure-vm-scale-set's People

Contributors

ardacetinkaya avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vasus1234

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.