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.
Prerequisites#
Ensure you have downloaded and installed the Pulumi CLI.
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 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.
Running the Example#
If you need to deploy an F5 BigIP appliance or backend HTTP instances as described above, first Configure Pulumi for AWS.
(Optional) Provision an F5 BigIP appliance on AWS#
-
Change directory to
f5bigip-ec2-instance.Terminal window cd f5bigip-ec2-instance -
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-2 # any valid AWS zone workspulumi 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 upThis will show you a preview, ask for confirmation, and then begin provisioning your resources:
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 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) Provision Backend NGINX Instances#
-
Change directory to
nginx-ec2-instance.Terminal window cd nginx-ec2-instance -
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 # any valid AWS zone works -
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 upThis will show you a preview, ask for confirmation, and then begin provisioning your resources:
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 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.
Provision F5 BigIP Application Pool Resources#
-
Change directory to
f5bigip-pool.Terminal window cd f5bigip-pool -
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> # the address of your BigIP appliance - i.e. https://10.10.10.200:8443pulumi config set f5bigip:username adminpulumi config set f5bigip:password <f5Password> # the 'admin' password of your BigIP appliancepulumi config set f5bigip-pool:backendInstances <address1:port,address2:port,...> # Comma-delimited list of IP addresses with ports to load balance - i.e. '10.0.0.10:80,10.0.0.11:80,10.0.0.12:80'pulumi config set f5bigip-pool:f5BigIpPrivateIp <f5PrivateIp> # the Private IP address of your BigIP appliance -
Deploy everything with the
pulumi upcommand. This provisions F5 BigIP LTM resources - application monitor, application pool, pool attachments, and virtual server:Terminal window pulumi upThis will show you a preview, ask for confirmation, and then begin provisioning your resources:
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 createdResources:+ 7 createdDuration: 3sAfter 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.
Clean 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 from above that you ran
pulumi upwithin.Terminal window pulumi destroypulumi stack rm