我在使用 AWS S3 go sdk ( https://github.com/awslabs/aws-sdk-go )在 golang 中保存文件時遇到了一些麻煩。這就是我所擁有的:import ( "fmt" "bytes" "github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/aws/awsutil" "github.com/awslabs/aws-sdk-go/service/s3")func main() { cred := aws.DefaultChainCredentials cred.Get() // i'm using environment variable credentials and yes, I checked if they were in here svc := s3.New(&aws.Config{Region: "us-west-2", Credentials:cred, LogLevel: 1}) params := &s3.PutObjectInput{ Bucket: aws.String("my-bucket-123"), Key: aws.String("test/123/"), Body: bytes.NewReader([]byte("testing!")), } resp, err := svc.PutObject(params) fmt.Printf("response %s", awsutil.StringValue(resp))}我不斷收到301 Moved Permanently回復。編輯:我手動創(chuàng)建了存儲桶。編輯 #2:示例響應:---[ RESPONSE ]--------------------------------------HTTP/1.1 301 Moved PermanentlyTransfer-Encoding: chunkedContent-Type: application/xmlDate: Tue, 05 May 2015 18:42:03 GMTServer: AmazonS3POST 標志也是 http。
- 2 回答
- 0 關注
- 383 瀏覽
添加回答
舉報
0/150
提交
取消