func loginKinesis(awsAccessKey, awsSecretKey, region string) *kinesis.Kinesis { //初始化环境变量 if (awsAccessKey == "") || (awsSecretKey == "") { awsAccessKey = "AAAAAACCCCCEEEEEEEEESSSSS" awsSecretKey = "AWSSSSSSSSSSSSKKKKKKKKKKKKKKKKYYYYYYYYYY" } err = os.Setenv("AWS_ACCESS_KEY", awsAccessKey) if err != nil { fmt.Println("ERROR:ACCESS_KEY SET----", err.Error()) } err = os.Setenv("AWS_SECRET_KEY", awsSecretKey) if err != nil { fmt.Println("ERROR:SECRET_KEY SET----", err.Error()) } // 从环境变量中获取accesskey和secretkey auth, err = kinesis.NewAuthFromEnv() if err != nil { fmt.Printf("Unable to retrieve authentication credentials from the environment: %v", err) } //认证登录 ksi := kinesis.New(auth, region) return ksi }