Object Storage Service


Object Storage Service



This document is compiled based on AWS Go SDK. JD Cloud object storage service supports the AWS S3 interface. For more information about compatible interfaces, see Compatible Interface.

Environment Preparation

Please use Go 1.5 or a higher version. To install or update Golang, please access Golang.

Installation Mode

To install AWS SDK for Go, please run commands below

go get github.com/aws/aws-sdk-go

Initialize Client

You can create S3Client to manage OSS resources such as bucket and file. To use Go SDK to initiate OSS request, you need to use your AccessKey and SecretKey to initiate a S3Client and modify the default configuration items of Config according to the needs.

The following example shows how to create a client. For more Go SDK samples, please access S3 Go Example Code](https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/go/example_code/s3).

package main

import (

func main() {

    ak := "your accesskey"
    sk := "your secretkey"
    creds := credentials.NewStaticCredentials(ak, sk, "")
    _,err := creds.Get()

    config := &aws.Config{
        Region          :aws.String("cn-north-1"),
        Endpoint        :aws.String("s3.cn-north-1.jdcloud-oss.com"),
        DisableSSL      :aws.Bool(false),
        Credentials     :creds,

    client := s3.New(session.New(config))
    //use s3 client to create bucket、put object....
Update Time:2019-05-28 16:47:18