Skip to main content

Search the Dev Center

Search tutorials, templates, examples, and more.

F5 BigIP Local Traffic Manager

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set f5bigip-ts-ltm-pool
cd pulumi-examples/f5bigip-ts-ltm-pool

This example demonstrates use of the Pulumi F5 BigIP provider to provide load balancing via an F5 BigIP appliance to backend HTTP instances. The example provisions:

  • an LTM Monitor with a Send String value of GET /
  • an LTM Pool using the LTM Monitor
  • N number of LTM Pool Attachments based on provided backend addresses
  • an LTM Virtual Server

All of these happen behind a single pulumi up command, and are expressed in just a handful of TypeScript.

This directory contains three Pulumi projects that are deployed in sequence:

Prerequisites#

  1. Install Pulumi
  2. Configure AWS credentials (needed if you deploy the optional AWS resources below)
  3. Install Node.js

If you already have an F5 BigIP appliance available, you only need administrative credentials to it and at least one backend HTTP instance to load balance to.

If you do not already have an F5 BigIP appliance available, you can use the example in f5bigip-ec2-instance to deploy an F5 BigIP instance on AWS using an F5 BigIP AMI from the AWS Marketplace. Note: you must first subscribe to the AWS Marketplace product here.

If you do not already have a backend HTTP instance available, you can use the example in nginx-ec2-instance to deploy multiple NGINX instances on AWS and use them as members of the LTM Pool as Pool Attachments.

Deploying the example#

(Optional) Provisioning an F5 BigIP appliance on AWS#

  1. Change directory to f5bigip-ec2-instance, then install dependencies:

    Terminal window
    cd f5bigip-ec2-instance
    npm install
  2. Create a new stack, which is an isolated deployment target for this example:

    Terminal window
    pulumi stack init f5bigip-ec2-instance-dev
  3. Set the required configuration variables for this program:

    Terminal window
    pulumi config set aws:region us-west-2
    pulumi config set f5BigIpAdminPassword --secret [your-new-bigip-password-here]
  4. Deploy everything with the pulumi up command. This provisions the necessary AWS resources, primarily a VPC security group and EC2 instance, in a single gesture:

    Terminal window
    pulumi up
    Updating (f5bigip-ec2-instance-dev):
    Type Name Status
    + pulumi:pulumi:Stack f5bigip-ec2-instance-f5bigip-ec2-instance-dev created
    + ├─ aws:ec2:SecurityGroup bigIp created
    + └─ aws:ec2:Instance bigIp created
    Outputs:
    f5Address : "https://34.210.83.227:8443"
    f5PrivateIp: "172.31.42.112"
    Resources:
    + 3 created
    Duration: 40s

    After this completes, numerous outputs will show up. f5Address and f5PrivateIp are values you will use in the f5bigip-pool example later on.

(Optional) Provisioning backend NGINX instances#

  1. Change directory to nginx-ec2-instance, then install dependencies:

    Terminal window
    cd nginx-ec2-instance
    npm install
  2. Create a new stack, which is an isolated deployment target for this example:

    Terminal window
    pulumi stack init nginx-ec2-instance-dev
  3. Set the required configuration variables for this program:

    Terminal window
    pulumi config set aws:region us-west-2
  4. Deploy everything with the pulumi up command. This provisions a VPC security group allowing access to NGINX from anywhere and three EC2 instances running NGINX:

    Terminal window
    pulumi up
    Updating (nginx-ec2-instance-dev):
    Type Name Status
    + pulumi:pulumi:Stack nginx-ec2-instance/-nginx-ec2-instance-dev created
    + ├─ aws:ec2:SecurityGroup nginx created
    + ├─ aws:ec2:Instance nginx-2 created
    + ├─ aws:ec2:Instance nginx-1 created
    + └─ aws:ec2:Instance nginx-0 created
    Outputs:
    instancePublicIps: [
    [0]: "52.35.179.187"
    [1]: "34.213.179.46"
    [2]: "54.184.63.40"
    ]
    Resources:
    + 5 created
    Duration: 44s

    After this completes, a single output with multiple values will display. instancePublicIps are the IP addresses you will use to provide load balancing to in the f5bigip-pool example.

Provisioning F5 BigIP application pool resources#

  1. Change directory to f5bigip-pool, then install dependencies:

    Terminal window
    cd f5bigip-pool
    npm install
  2. Create a new stack, which is an isolated deployment target for this example:

    Terminal window
    pulumi stack init f5bigip-pool-dev
  3. Set the required configuration variables for this program:

    Terminal window
    pulumi config set f5bigip:address <f5Address>
    pulumi config set f5bigip:username admin
    pulumi config set f5bigip:password <f5Password>
    pulumi config set f5bigip-pool:backendInstances <address1:port,address2:port,...>
    pulumi config set f5bigip-pool:f5BigIpPrivateIp <f5PrivateIp>
  4. Deploy everything with the pulumi up command. This provisions F5 BigIP LTM resources — application monitor, application pool, pool attachments, and virtual server:

    Terminal window
    pulumi up
    Updating (f5bigip-pool-dev):
    Type Name Status
    + pulumi:pulumi:Stack f5bigip-pool-f5bigip-pool-dev created
    + ├─ f5bigip:ltm:Monitor backend created
    + ├─ f5bigip:ltm:Pool backend created
    + ├─ f5bigip:ltm:VirtualServer backend created
    + ├─ f5bigip:ltm:PoolAttachment backend-0 created
    + ├─ f5bigip:ltm:PoolAttachment backend-2 created
    + └─ f5bigip:ltm:PoolAttachment backend-1 created
    Resources:
    + 7 created
    Duration: 3s

Cleaning up#

Once you are done, you can destroy all of the resources, and the stack. Repeat this in each directory for each of the examples above that you ran pulumi up within:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.