F5 BigIP Local Traffic Manager
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 f5bigip-ts-ltm-poolcd pulumi-examples/f5bigip-ts-ltm-poolThis 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:
- f5bigip-ec2-instance/ — (optional) provisions an F5 BigIP appliance on AWS.
- nginx-ec2-instance/ — (optional) provisions backend NGINX instances on AWS.
- f5bigip-pool/ — provisions the F5 BigIP LTM pool resources.
Prerequisites#
- Install Pulumi
- Configure AWS credentials (needed if you deploy the optional AWS resources below)
- 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#
-
Change directory to
f5bigip-ec2-instance, then install dependencies:Terminal window cd f5bigip-ec2-instancenpm install -
Create a new stack, which is an isolated deployment target for this example:
Terminal window pulumi stack init f5bigip-ec2-instance-dev -
Set the required configuration variables for this program:
Terminal window pulumi config set aws:region us-west-2pulumi config set f5BigIpAdminPassword --secret [your-new-bigip-password-here] -
Deploy everything with the
pulumi upcommand. This provisions the necessary AWS resources, primarily a VPC security group and EC2 instance, in a single gesture:Terminal window pulumi upUpdating (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 createdOutputs:f5Address : "https://34.210.83.227:8443"f5PrivateIp: "172.31.42.112"Resources:+ 3 createdDuration: 40sAfter this completes, numerous outputs will show up.
f5Addressandf5PrivateIpare values you will use in thef5bigip-poolexample later on.
(Optional) Provisioning backend NGINX instances#
-
Change directory to
nginx-ec2-instance, then install dependencies:Terminal window cd nginx-ec2-instancenpm install -
Create a new stack, which is an isolated deployment target for this example:
Terminal window pulumi stack init nginx-ec2-instance-dev -
Set the required configuration variables for this program:
Terminal window pulumi config set aws:region us-west-2 -
Deploy everything with the
pulumi upcommand. This provisions a VPC security group allowing access to NGINX from anywhere and three EC2 instances running NGINX:Terminal window pulumi upUpdating (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 createdOutputs:instancePublicIps: [[0]: "52.35.179.187"[1]: "34.213.179.46"[2]: "54.184.63.40"]Resources:+ 5 createdDuration: 44sAfter this completes, a single output with multiple values will display.
instancePublicIpsare the IP addresses you will use to provide load balancing to in thef5bigip-poolexample.
Provisioning F5 BigIP application pool resources#
-
Change directory to
f5bigip-pool, then install dependencies:Terminal window cd f5bigip-poolnpm install -
Create a new stack, which is an isolated deployment target for this example:
Terminal window pulumi stack init f5bigip-pool-dev -
Set the required configuration variables for this program:
Terminal window pulumi config set f5bigip:address <f5Address>pulumi config set f5bigip:username adminpulumi config set f5bigip:password <f5Password>pulumi config set f5bigip-pool:backendInstances <address1:port,address2:port,...>pulumi config set f5bigip-pool:f5BigIpPrivateIp <f5PrivateIp> -
Deploy everything with the
pulumi upcommand. This provisions F5 BigIP LTM resources — application monitor, application pool, pool attachments, and virtual server:Terminal window pulumi upUpdating (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 createdResources:+ 7 createdDuration: 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:
pulumi destroypulumi stack rm