Hello guys, I have some issues to make work a DO spaces presign url in aws golang sdk.
I have the following code snippet:

import (

key := parameters.ObjectStorageKey
    secret := parameters.ObjectStorageSecret

    s3Config := &aws.Config{
        Credentials: credentials.NewStaticCredentials(key, secret, ""),
        Endpoint:    aws.String(parameters.ObjectStorageEndpoint),
        Region:      aws.String(parameters.ObjectStorageRegion),

    newSession, err := session.NewSession(s3Config)
    if err != nil {
        return "", err

    s3Client := s3.New(newSession)

    req, _ := s3Client.GetObjectRequest(&s3.GetObjectInput{
        Bucket: aws.String(parameters.ObjectStorageBucketErp),
        Key:    aws.String("MY_OBJECT_KEY"),

    urlStr, header, err := req.PresignRequest(10 * time.Minute)
    if err != nil {


It is generating the url, but when I put it to browser it gives me access denied error. When I generate a link in the control panel it is working without any issue.

What I experienced there is a difference in the link generated by my code and in the control panel.

Link generated in the control panel look like this:


Link generated by my code is like this:


I don’t know if its cause the problem or not, but I stuck here…
Is there anything what I’m doing wrong?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Next day it is just working… Don’t know what was the problem yesterday, but now it’s fine. So above you can see a working golang example :).