Amazon S3 to a proxy in go

Hi,

When using the Python boto module I can specify a proxy, along with proxy_port/user/password, etc., in the connection to S3. How would I do that in go?

As an example, assume that I have a system providing an S3 interface at host fred.flintstone.com on port 8080. In Python I would do:

s3connection = boto.connect_s3(“s3user”,“s3key”,proxy=“fred.flintstone.com”,proxy_port=8080,proxy_user=None,proxy_pass=None,is_secure=False)

Thanks,

Rob

Turns out it wasn’t too hard to figure out. The thing that tripped me up was having to provide a valid, e.g. us-east-1, region even though I’m not actually trying to get to an Amazon endpoint. What I ended up with, approximately is:

func GetS3Client(endpoint, access_key, secret_key, region string) *s3.S3 {
             s3Config := &aws.Config{
                Credentials: credentials.NewStaticCredentials(access_key, secret_key), ""),
                Endpoint:    aws.String(endpoint)),
                Region:      aws.String(region)),
        }
  
        sess := session.Must(session.NewSession(s3Config))
        return s3.New(sess)
}

I can call it with:

s3conn := GetS3Client("http://fred.flintstone.com:8080","s3user","s3key","us-east-1")

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.