This tutorial uses the CreateLoadBalancer API of SLB to show you how to use Alibaba Cloud Go SDK to call SLB APIs.

Alibaba Cloud Server Load Balancer (SLB) is a traffic distribution control service that distributes the incoming traffic among multiple Elastic Compute Service (ECS) instances according to the configured forwarding rules. It expands the service capabilities of the application and increases the availability of the application. 

Code example

Notice Running the code in this example will create an SLB instance and generate fees.
package main

import (

func main() { 
    // Create the slbClient instance
    client, err := slb.NewClientWithAccessKey(
        "<Your-region-ID>", // your region ID
        "<Your-access-key-ID>", // your AccessKey ID
        "<your-access-key-secret>") // your AccessKey Secret
    if err ! = nil {
        // Handle exceptions
    // Create a request and set parameters
    request := slb.CreateCreateLoadBalancerRequest()
    request.LoadBalancerName = "MyLoadBalancer"
    request.AddressType = "internet"
    request.ClientToken = utils.GetUUIDV4() 
    response, err := client.CreateLoadBalancer(request)    
    if err ! = nil {
        // Handle exceptions
    fmt.Printf("success(%d)! loadBalancerId = %s\n", response.GetHttpStatus(), response.LoadBalancerId)