Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service/ecs 安全检验始终选择cn-hangzhou #531

Open
Raymond0331 opened this issue Sep 17, 2021 · 6 comments
Open

service/ecs 安全检验始终选择cn-hangzhou #531

Raymond0331 opened this issue Sep 17, 2021 · 6 comments

Comments

@Raymond0331
Copy link

Raymond0331 commented Sep 17, 2021

从香港ecs 调用service/ecs 在accesskey 身份校验总是选择cn-hangzhou 导致超时。报错如下:
Post "https://ecs-cn-hangzhou.aliyuncs.com/?AccessKeyId=xxx&Action=DescribeInstances&Format=JSON&PageSize=100&RegionId=cn-hongkong&Signature=dddxxx&SignatureMethod=HMAC-SHA1&SignatureNonce=08de82467031220486323a2966c470c4&SignatureType=&SignatureVersion=1.0&Timestamp=2021-09-17T08%3A34%3A50Z&Version=2014-05-26": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

我的golang代码如下:

client, err := ecs.NewClientWithAccessKey("cn-hongkong", string(akid), string(aks))
if err != nil {
	// 异常处理
	panic(err)
}
request := ecs.CreateDescribeInstancesRequest()
request.SetReadTimeout(30 * time.Second)
request.SetConnectTimeout(30 * time.Second)
request.Scheme = "https"

request.PageSize = requests.NewInteger(100)

response, err := client.DescribeInstances(request)
@Raymond0331
Copy link
Author

alibaba-cloud-sdk-go/sdk/endpoints/ 代码文件mapping_resolver.go 函数GetEndpointFromMap第44行
key := fmt.Sprintf(keyFormatter, strings.ToLower(regionId), strings.ToLower(productId))
这个key返回cn-hongkong::ecs没有问题,但是问题在第46行代码
endpoint := endpointMapping.endpoint[key]
这个endpoint返回ecs-cn-hangzhou.aliyuncs.com

@qsyqian
Copy link

qsyqian commented Sep 28, 2021

遇到了类似的问题 是使用姿势不对吗?

@Raymond0331
Copy link
Author

遇到了类似的问题 是使用姿势不对吗?

你需要选择内网访问也就是走vpc,不过这样子外网机器就无法访问,但是如果在香港的外网机器要通过脚本修改或者查询一些东西又跑回去杭州的endpoint就又经常失败,不知道怎么解决,阿里那边也没有给出具体解决办法

@zibber2015
Copy link

深圳的ecs 走cn-shenzhen 偶尔也会失败

@Raymond0331
Copy link
Author

深圳的ecs 走cn-shenzhen 偶尔也会失败

一堆问题貌似阿里都不打算fix了

@JacksonTian
Copy link
Contributor

这个问题是 gfw 的问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants