简体   繁体   中英

How to deploy API into API Gateway stage using AWS CLI?

I am trying to deploy lambda function into API Gateway using AWS CLI. I am using aws apigateway put-integration and aws apigateway put-integration-response to update the integration part. I am able to do till this part. Next step is I want to deploy this API into stage. I am using aws apigateway create-deployment --rest-api-id 1234123412 --stage-name dev . But when I test API after I deploy, I am getting error message Internal server error . API works fine when I go to API Gateway console and on Integration Request and click on edit button of Lambda Function and don't modify function name, then go back and deploy manually. But I am not able get it work using AWS CLI. Is there any work around for this problem?

I believe you need to do an updateStage api call and patch the stage with the new deploymentId. https://docs.aws.amazon.com/cli/latest/reference/apigateway/update-stage.html

patch operation:

op: replace
path: /deploymentId
value: <id from create-deployment>. 

https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-deployments.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM