Comments (4)
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?
from serverless-application-model.
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:
1- We determined a Version for the UI ( it is bumped when a change is detected in one of the UI compoents)
2- Create/Update API stack, we pass the UI version and bucket name as parameters to build the uri.
3- Build the FrontEnd package
4- Upload to the S3 versioned folder
5- Deploy Front End API
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.
from serverless-application-model.
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 AWS::ApiGateway::Deployment
is generated within SAM. So since you are doing a stack update, the expectation is new changes to you API Gateway are deployed. Since you are updating your stack and SAM is detecting changes, that is "consent" to deploy the API Gateway. This is not something we can change and in most cases is what customers want. So if you are updating the API, you should expect SAM will deploy it on stack update.
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).
from serverless-application-model.
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
from serverless-application-model.
Related Issues (20)
- "Invalid OpenAPI input" when OpenAPI set to `3.1.0` HOT 4
- AWS SAM Connector Write needs PutObjectTagging HOT 2
- Setting the runtime of a function to nodejs20.x causes sam validate to fail. HOT 2
- AWS::Serverless::Api - setting "OpenApiVersion" causes "Stage" deployment to be skipped - why? HOT 6
- [Test] GitHub Action automatic comments on GitHub closed Issue HOT 1
- AlwaysDeploy does not include GatewayResponse updates HOT 7
- Please explain how to version AWS::Serverless::Function artifacts cleanly HOT 11
- Bug: AWS::Serverless::Function Policies partly not applied HOT 8
- Cors error from SAM template and Auth enabled. HOT 3
- VSCode SAM Schema Validation Error with !Ref in Conditions Section HOT 7
- Bug: Creates unnecessary AWSLambdaVPCAccessExecutionRole role HOT 7
- Api CORS issue with 500 status after setup Cognito authorizer HOT 3
- Building features for AWS SAM HOT 4
- Can't reset BinaryMediaTypes to a default value for API Gateway REST API HOT 2
- Environment variables not updated HOT 5
- Bug: Using a Ref in StageName is Not Working Properly - Template.yaml HOT 4
- !If not working on Serverless:Function handler HOT 5
- how to configure KMSVerifyPolicy and KMSSignPolicy HOT 1
- Feature request: Git sync HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-application-model.