d.y
d.y

Reputation: 145

How to automate API Gateway deployment via SAM deploy?

When I changed AWS::ApiGateway::Method properties by AWS SAM template and deployed it. but I noticed that change was not reflected until I deploy API manually from AWS management console. I think it is because I didn't change the resource of AWS::ApiGateway::Deployment and AWS::ApiGateway::Stage on the template.(The deployment history of AWS::ApiGateway::Stage was not updated.)

How can I reflect the change when I trigger sam deploy?

Upvotes: 4

Views: 1296

Answers (2)

Vishwasa Navada K
Vishwasa Navada K

Reputation: 642

If you are still looking for a solution for this, SAM has recently(March 2023) introduced a property under AWS::Serverless::Api called AlwaysDeploy which forces API to be deployed even when there is no changes to API whenever there is sam deploy.

Reference:

  1. AWS::Serverless::Api Documentation
  2. PR to SAM on Github

Note that this will only work if you have your sam cli up to date (>v1.78.0) in your local machine or CI/CD where you will be running sam build.

Upvotes: 4

Arun Kamalanathan
Arun Kamalanathan

Reputation: 8593

No, you have to manually deploy the api from the console :) it's a limitation at the moment.

Upvotes: 1

Related Questions