Brammz
Brammz

Reputation: 389

AWS SAM update function code of lambda of an API Gateway

I am using CloudFormation with SAM to deploy a stack which contains:

To deploy my stack, I first run aws cloudformation package to package the lambda and then run aws cloudformation deploy to deploy the generated stack. This is working.

My goal now is to be able to update a microservice without deploying the entire stack (not building authorizers and other microservices), similar to serverless deploy function in the Serverless framework. This should preferably be one reusable template that uses a macro or just replaces text in the file.

The problem I am facing with this:

I feel like I am stuck here and have not found other options of achieving my goal.

Upvotes: 0

Views: 4192

Answers (1)

maafk
maafk

Reputation: 6906

Since you're using SAM, I'd recommend deploying and updating your application using the sam cli commands.

You can run

  • sam build
  • sam package
  • sam deploy

When you run sam deploy, it deploys your application, but all subsequent sam deploy commands will update your existing cloudformation stack with only the appropriate resources that need updating.

If you opt for keeping with the standard Cloudformation cli commands, you could use the aws cloudformation update-stack command so that you're not re-deploying an entire new stack.

Upvotes: 3

Related Questions