Coder Social home page Coder Social logo

Comments (4)

paulhcsun avatar paulhcsun commented on June 5, 2024

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.

ariasvzla avatar ariasvzla commented on June 5, 2024

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.

jfuss avatar jfuss commented on June 5, 2024

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.

github-actions avatar github-actions commented on June 5, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.