This topic describes how to install Resource Access Management (RAM) SDK for Go and provides an example on how to use RAM SDK for Go.

Background information

  • Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to debug API operations and dynamically generate SDK sample code.
  • For more information about RAM API operations, see List of operations by function.

Install the SDK for Go

You can download the installation packages of the SDKs for Go from the following links:


The following sample code provides an example on how to call the CreateUser operation by using RAM SDK for Go. For other operations, you can use OpenAPI Explorer to debug the operations and obtain sample code.

package main

import (

func main() {
    // Construct an Alibaba Cloud client that is used to initiate requests. 
    // When you construct the client, specify the AccessKey ID and AccessKey secret. 
    client, err := ram.NewClientWithAccessKey("<accessKeyId>", "<accessKeySecret>")

    request := ram.CreateCreateUserRequest()
    request.Scheme = "https"
    // Specify request parameters. For more information about the parameters, see API Reference. 
    request.UserName = "<UserName>"
    // Initiate the request and obtain a response. 
    response, err := client.CreateUser(request)
    if err != nil {
    fmt.Printf("response is %#v\n", response)