开发者社区> 问答> 正文

Golang create instance failed

各位专家,

我在调用Ali Go cloud API时候遇到下面报错.  下面是代码片段:

报错信息是:
Server ErrorCode:  InvalidResourceType.NotSupported , Error Message:  This resource type is not supported; please try other resource types.

如何获取更加具体的信息,比如怎么获取有效的resource type。 谢谢

ecsClient, err := ecs.NewClientWithOptions("cn-hangzhou", config, credential)
........
// create instance
createRequest := requests.NewCommonRequest()
createRequest.Method = "POST"
createRequest.Domain = "ecs.aliyuncs.com"
createRequest.Version = "2014-05-26"
createRequest.ApiName = "CreateInstance"
// ecs.t1.xsmall ecs.t1.small ecs.s2.small ecs.s1.small
createRequest.QueryParams["InstanceType"] = "ecs.g5.large"
createRequest.QueryParams["ImageId"] = "centos_7_04_64_20G_alibase_201701015.vhd"
createRequest.QueryParams["RegionId"] = "cn-hangzhou"
createRequest.QueryParams["InstanceName"] = "AliAPICreate"
createRequest.QueryParams["HostName"] = "Elan"
//createRequest.QueryParams["SecurityGroupId"] = "None"
createRequest.QueryParams["SystemDisk.Size"] = "40" // GB
createRequest.QueryParams["SystemDisk.Category"] = "cloud"

if response, err := ecsClient.ProcessCommonRequest(createRequest); err != nil {
log.Println(errHandle(err))
} else {
fmt.Print(response.GetHttpContentString())
}

展开
收起
288843537326375472 2018-09-20 21:29:22 1000 0
1 条回答
写回答
取消 提交回答
  • 您好,这个错误提示是当前没有这种规格的ECS了,需要更换其他规格的。
    2018-09-21 00:19:02
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Well-That-Escalated-Quickly-How-Abusing-The-Docker-API-Led-To-Remote-Code-Execution-Same-Origin-Bypass-And-Persistence 立即下载
OPEN SOURCE IN A DATA-DRIVEN WORLD 立即下载
In-Flux Limiting for a Multi-Tenant Logging Service 立即下载