我是 AWS SAM 部署的新手。我有一个使用 SAM AWS 自动部署的用例。拥有一个带有另一个 HTTP 端点调用的 Rest API GW。我搜索了更多文档,但没有找到任何解决方案。你能建议我怎么做这个案子吗?
提前致谢。卡西克扬 B
我是 AWS SAM 部署的新手。我有一个使用 SAM AWS 自动部署的用例。拥有一个带有另一个 HTTP 端点调用的 Rest API GW。我搜索了更多文档,但没有找到任何解决方案。你能建议我怎么做这个案子吗?
提前致谢。卡西克扬 B
您可以尝试创建集成的示例模板 -
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS SAM template with a HTTP integration
Resources:
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
StageName: prod
DefinitionBody: {
"swagger": "2.0",
"info": {
"version": "1.0"
},
"paths": {
"test": {
"get": {
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "200 response"
}
},
"x-amazon-apigateway-integration": {
"responses": {
"default": {
"statusCode": "200"
}
},
"credentials": "arn:aws:iam::account-id:role/role-name",
"uri": "https://www.example.com",
"passthroughBehavior": "when_no_match",
"httpMethod": "GET",
"type": "http_proxy"
}
}
}
}
}
使用CLI部署模板-
$ sam deploy --stack-name httpProxy -t httpProxy.yaml --capabilities CAPABILITY_IAM