我正在尝试创建一个API方法,例如:
ApiIndex:
Type: AWS::Serverless::Function
Properties:
Handler: src/apis/index.handler
FunctionName: !Sub '${ProjectName}-api-index'
Role: !GetAtt LambdaExecutionRole.Arn
ApiIndexMethod:
Type: AWS::ApiGateway::Method
Properties:
HttpMethod: ANY
AuthorizationType: NONE
Integration:
Type: AWS_PROXY
IntegrationHttpMethod: GET
Uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ApiIndex.Arn}/invocations
OperationName: Index
ResourceId:
Fn::ImportValue:
!Sub ${BaseStack}-apiroot
RestApiId:
Fn::ImportValue:
!Sub ${BaseStack}-api
但是我得到:
指定了无效的方法标识符(服务:AmazonApiGateway;状态代码:404;错误代码:NotFoundException)
定义我的API网关的其他堆栈如下:
Resources:
Api:
Type: AWS::ApiGateway::RestApi
Properties:
Description: !Sub ${ProjectName} API gateway
EndpointConfiguration:
Types:
- REGIONAL
Name: !Ref ProjectName
Outputs:
Api:
Description: API gateway
Value: !Ref Api
Export:
Name: !Sub ${AWS::StackName}-api
ApiRootResourceId:
Description: API Gateway root resource ID
Value: !GetAtt Api.RootResourceId
Export:
Name: !Sub ${AWS::StackName}-apiroot
这是怎么了?