Code Monkey home page Code Monkey logo

network-python-manage-loadbalancer's Introduction

page_type languages products description urlFragment
sample
python
azure
This sample shows how to manage a load balancer using the Azure Resource Manager APIs for Python.
network-python-manage-loadbalancer

Getting Started with Azure Resource Manager for load balancers in Python

This sample shows how to manage a load balancer using the Azure Resource Manager APIs for Python.

You can use a load balancer to provide high availability for your workloads in Azure. An Azure load balancer is a Layer-4 (TCP, UDP) type load balancer that distributes incoming traffic among healthy service instances in cloud services or virtual machines defined in a load balancer set.

For a detailed overview of Azure load balancers, see Azure Load Balancer overview.

alt tag

This sample deploys an internet-facing load balancer. It then creates and deploys two Azure virtual machines behind the load balancer. For a detailed overview of internet-facing load balancers, see Internet-facing load balancer overview.

To deploy an internet-facing load balancer, you'll need to create and configure the following objects.

  • Front end IP configuration - contains public IP addresses for incoming network traffic.
  • Back end address pool - contains network interfaces (NICs) for the virtual machines to receive network traffic from the load balancer.
  • Load balancing rules - contains rules mapping a public port on the load balancer to port in the back end address pool.
  • Inbound NAT rules - contains rules mapping a public port on the load balancer to a port for a specific virtual machine in the back end address pool.
  • Probes - contains health probes used to check availability of virtual machines instances in the back end address pool.

You can get more information about load balancer components with Azure resource manager at Azure Resource Manager support for Load Balancer.

Tasks performed in this sample

The sample performs the following tasks to create the load balancer and the load-balanced virtual machines:

  1. Create a resource group
  2. Create a public IP
  3. Build the load balancer payload
  4. Build a front-end IP pool
  5. Build a back-end address pool
  6. Build a health probe
  7. Build a load balancer rule
  8. Build inbound NAT rule 1
  9. Build inbound NAT rule 2
  10. Create the load balancer with the above payload
  11. Create a virtual network (vnet)
  12. Create a subnet
  13. Create NIC 1
  14. Create NIC 2
  15. Find an Ubutnu VM image
  16. Create an availability set
  17. Create the first VM: Web1
  18. Create the second VM: Web2
  19. Delete the resource group and the resources created in the previous steps

Run this sample

  1. If you don't already have a Microsoft Azure subscription, you can register for a free trial account.

  2. Install Python if you haven't already.

  3. We recommend using a virtual environment to run this example, but it's not mandatory. You can initialize a virtual environment this way:

     pip install virtualenv
     virtualenv mytestenv
     cd mytestenv
     source bin/activate
    
  4. Clone the sample repository.

     git clone https://github.com/Azure-Samples/network-python-manage-loadbalancer.git    
    
  5. Install the dependencies using pip.

     cd network-python-manage-loadbalancer
     pip install -r requirements.txt    
    
  6. Create an Azure service principal, using Azure CLI, PowerShell or Azure Portal.

  7. Export these environment variables into your current shell.

     export AZURE_TENANT_ID={your tenant ID}
     export AZURE_CLIENT_ID={your client ID}
     export AZURE_CLIENT_SECRET={your client secret}
     export AZURE_SUBSCRIPTION_ID={your subscription ID}
    
  8. Run the sample.

     python example.py
    

More information

network-python-manage-loadbalancer's People

Contributors

acomsmpbot avatar allclark avatar jasonrshaver avatar lmazuel avatar tamram avatar v-rajagt-zz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

network-python-manage-loadbalancer's Issues

[Action Needed] This repo is inactive

This GitHub repository has been identified as a candidate for archival

This repository has had no activity in more than [x amount of time]. Long periods of inactivity present security and code hygiene risks. Archiving will not prevent users from viewing or forking the code. A banner will appear on the repository alerting users that the repository is archived.

Please see https://aka.ms/sunsetting-faq to learn more about this process.

Action

✍️

❗**If this repository is still actively maintained, please simply close this issue. Closing an issue on a repository is considered activity and the repository will not be archived.🔒

If you take no action, this repository is still inactive 30 days from today it will be automatically archived..

Need more help? 🖐️

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.