【发布时间】:2017-04-27 18:18:40
【问题描述】:
我正在尝试使用 CloudFormation 创建 AWS::ApiGateway::RestApi 资源,但在运行时
aws cloudformation deploy --template-file lorem.json --stack-name lorem
这最终失败了,在查看 CloudFormation 控制台时,我发现错误是 Invalid REST API identifier specified。
这是我的lorem.json 文件:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "lorem.io Stack",
"Resources": {
"API": {
"Type" : "AWS::ApiGateway::RestApi",
"Properties" : {
"FailOnWarnings": true,
"BodyS3Location": {
"Bucket": "cloudformation.lorem.io",
"Key": "open-api.json"
}
}
}
}
}
这里我指定了BodyS3Location,它指向一个包含以下内容的 S3 对象:
{
"swagger": "2.0",
"info": {
"title": "Lorem.IO API",
"version": "1.0.0"
},
"definitions": {
"Generator": {
"type": "object",
"properties": {
"title": {
"type": "string"
}
}
}
},
"produces": [
"application/json"
],
"paths": {
"/generators": {
"get": {
"responses": {
"200": {
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Generator"
}
}
}
}
}
}
}
}
因为我是根据documentation 提供这个文件的,所以我不应该提供 RestApi 的名称,所以我认为这不是问题所在。知道我将如何去调试它不满意的地方吗?
更新 #1
我已经删除了很多配置,因此我现在指定的唯一属性是 name,但我仍然收到相同的错误 (Invalid REST API identifier specified):
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "lorem.io Stack",
"Resources": {
"API": {
"Type" : "AWS::ApiGateway::RestApi",
"Properties" : {
"FailOnWarnings": true,
"Name": "Hello World"
}
}
}
}
根据 documentation Name 是唯一必需的属性 - 这是 CloudFormation 的错误还是我遗漏了什么?
【问题讨论】:
标签: amazon-web-services amazon-cloudformation