-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS::Serverless::Api auto deploys API when a resource is being added #3520
Comments
Hi @ariasvzla, SAM's responsibility is to transform AWS::Serverless::Api to Cloudformation so I don't believe this is a SAM issue. It seems like you're either uploading to S3 after the Clouformation deployment is finished or your Cloudformation stack is not deploying in a specific order that you need for your use case. To help me better understand, could you describe how you're deploying the stack when you upload to S3 and provide a minimal example to explain what's going on here? |
Hi Paul, We have a FrontEnd API that is being created via CFN using AWS::Serverless::Api macro, this has integration with S3, so the endpoints points to a versioned folder. Order of deployment is: The ideal scenario for us is to deploy the API after files are uploaded, but the deployment is happening on step 2 (see order of deployment), when we add/remove a resource to the API, this causes the API uri points to a empty versioned folder, creating an outage until step 4 is completed. The expectation is that, when we add or remove a resource from the API the deployment only will occur on step 5. According to this https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources-api.html the resource AWS::ApiGateway::Deployment is being created on creation, but looks like it changes on update also, triggering a deployment without our consent. |
This doc is miss leading. The You will need to change your deployment order to achieve what you want. Specifically, you want step 4 to happen before Step 2. From what you described, there shouldn't be any reason that can't happen. You can probably do something else but would require you to manage the Deployment Resource, which requires you to move off of SAM's resources. I wouldn't recommend this because there are some sharp edges you will run into trying to manage API Gateway Deployments in CloudFormation (which is what SAM is solving for you here). |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Description
The AWS::Serverless::Api deploys the API when a resource to the stage is being added, this is causing a path change in the S3 versioned static site, causing outages.
Steps to reproduce
add new resource to api stage, bump the S3 version, deploy.
Observed result
The path to a new version is being made and deployed before we upload files to the S3 key
Expected result
The addition of a resource should not trigger API deployments
The text was updated successfully, but these errors were encountered: