Sample code for 30+ languages & platforms
Go

Generate S3 Signed URL

See more Amazon S3 Examples

Demonstrates how to generate a pre-signed S3 URL.

Chilkat Go Downloads

Go
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http := chilkat.NewHttp()

    // Insert your access key here:
    http.SetAwsAccessKey("AWS_ACCESS_KEY")

    // Insert your secret key here:
    http.SetAwsSecretKey("AWS_SECRET_KEY")

    http.SetAwsRegion("us-west-2")
    http.SetAwsEndpoint("s3-us-west-2.amazonaws.com")

    bucketName := "chilkattest"
    path := "starfish.jpg"

    signedUrl := http.S3_GenPresignedUrl("GET",true,bucketName,path,3600,"s3")
    if http.LastMethodSuccess() == false {
        fmt.Println(http.LastErrorText())
        http.DisposeHttp()
        return
    }

    fmt.Println(*signedUrl)

    http.DisposeHttp()