dongrenzheng1619 2018-02-15 21:29
浏览 125
已采纳

在Golang中获取用于S3映像上传的S3_REGION

I wanted to upload an image in aws s3.

const (
    S3_REGION = ""
    S3_BUCKET = ""
)

func main() {

    // Create a single AWS session (we can re use this if we're uploading many files)
    s, err := session.NewSession(&aws.Config{Region: aws.String(S3_REGION)})
    if err != nil {
        log.Fatal(err)
    }

    // Upload
    err = AddFileToS3(s, "result.csv")
    if err != nil {
        log.Fatal(err)
    }
}

I am stuck here. Where can I get S3_REGION as per this code standard? Source : https://golangcode.com/uploading-a-file-to-s3/

  • 写回答

1条回答 默认 最新

  • dongxieyi9115 2018-02-16 00:47
    关注

    When you log in to the AWS console you see on the top right which region you are logged in to, for example "Oregon" which refers to the "us-west-2" region.

    AWS Region Codes

    Please refer to this table and this link.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法