使用 SAM AWS 通过 HTTP 端点集成部署 REST API?
Deploy REST API with HTTP Endpoint Integration using SAM AWS?
我是 AWS SAM 部署的新手。我有一个使用 SAM AWS 自动化部署的用例。使用另一个 HTTP 端点调用的 Rest API GW。我搜索了更多文档,但没有找到任何解决方案。你介意建议我如何处理这个案例吗?
提前致谢。
Karthikeyan 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
我是 AWS SAM 部署的新手。我有一个使用 SAM AWS 自动化部署的用例。使用另一个 HTTP 端点调用的 Rest API GW。我搜索了更多文档,但没有找到任何解决方案。你介意建议我如何处理这个案例吗?
提前致谢。 Karthikeyan 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