Cloudflare Load Balancer Register/Deregister Instances

About a year ago Cloudflare introduced load balancer support for websites. You can find more information about Cloudflare Load Balancers here.

I have done a lot of research about this service and it is super interesting. I have worked with the Amazon Web Services Elastic Load Balancing system before, but thought I should give Cloudflare's a try due how impressed I am with their overall service.

The one big problem I was thinking about is how to register and deregister instances to my load balancer. AWS makes this super easy with CodeDeploy. CodeDeploy will automatically register and deregister EC2 instances for every deployment (if you set it up by toggling the switch).

I needed something that simple that I could just easily add to my existing CodeDeploy scripts to register and deregister my instances to the Cloudflare Load Balancer. So of course, whenever I need something that I can't find easily, I build it!!

Introducing the cloudflare-load-balance-manager CLI tool!!

After you install with one simple command you can easily register the instance to your Cloudflare load balancer.

cloudflare-load-balance-manager register --email [email protected] --api-key abcdefghijlmnopqrstuvwxyzabcde --name lb1

Just as easily you can deregister your instance from your Cloudflare load balancer.

cloudflare-load-balance-manager deregister --email [email protected] --api-key abcdefghijlmnopqrstuvwxyzabcde --name lb1

This tool is super useful for deployments when you want to easily register and deregister your instances before and after deployments to ensure no traffic hits the instance during the deployment.

Now that I have built this tool I'm interested in testing our the Cloudflare load balancer system more. Maybe I'll even write a blog post about my thoughts later on.

If you notice a problem with the package submit a issue or PR, and if you have any features you would like to add please submit a PR to help improve the tool.