2

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?

Sangam Belose
  • 4,262
  • 8
  • 26
  • 48
d.y
  • 105
  • 1
  • 6
  • Related to: https://stackoverflow.com/questions/41423439/cloudformation-doesnt-deploy-to-api-gateway-stages-on-update As suggested in one of the answers there, a possible workaround is to (manually or automatically) run `aws apigateway create-deployment` after `sam deploy`. – Paolo Rovelli Jun 23 '23 at 12:03

2 Answers2

2

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.

Vishwasa Navada K
  • 572
  • 1
  • 8
  • 30
1

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

Arun Kamalanathan
  • 8,107
  • 4
  • 23
  • 39
  • Thank you for your quick response and noted. – d.y Jan 10 '20 at 05:36
  • I have not tried this approach, looks like if you change the logical name of the deployment resource, it will trigger the deployment it seems, have a crack at it if you want, https://medium.com/@ngchiwang/aws-apigateway-deployment-not-update-3e04fcffe85b – Arun Kamalanathan Jan 10 '20 at 06:04
  • 1
    Thanks. I understand the approach to always recreate the stage resource by putting timestamp. wow. I'll try it. – d.y Jan 10 '20 at 08:30
  • but I noticed I always need to put timestamp when I modify the setting related to API gateway. have to remember to change... – d.y Jan 10 '20 at 08:41
  • Ya it's not the best solution – Arun Kamalanathan Jan 10 '20 at 08:46
  • @d.y Actually what I did is to create another task after sam-deploy which deploys my API base on a domain name. if it's still relevant I can post an answer. – Assael Azran Jan 12 '20 at 06:14