DEV Community

Discussion on: Size matters - Image Compression with Lambda and S3

Collapse
 
thissayantan profile image
Sayantan

It's a really nice article. Got me up and running. But after I made changes to the script how do I re-deploy? It shows error that it already exist. So how do I deploy only the updated code?

Collapse
 
aarongarvey profile image
Aaron Garvey

Hi Sayantan,

Hard to say what the actual problem might be without seeing all the error logs, but typically when redeploying cloud formation assets there could be a couple of issues that trip it up. The most common would be if one of the resources created by the cloud formation stack has been manually modified in the aws console. For example, if you create the s3 buckets using AWS Sam, then edit the bucket in S3, this can potentially break the logical ids used between Sam/Cloudformation and the actual resource. So when you try to update, cloud formation is unsure of how to resolve the changes. If this is the case, and your not yet running production workload, it’s best to delete the modified resource and re-deploy again.

Hope this helps.

Collapse
 
thissayantan profile image
Sayantan

Thanks for your response. I was also doing the same. But even in this way everytime I need to delete the Cloudformation, Buckets etc. I need is to re-deploy the lamdba. Bucket and other things are fine already. Could you please point me towards right direction? I'm actually new to lambda. Created my first ever lambda with the help of your article. Thanks for that.

Thread Thread
 
aarongarvey profile image
Aaron Garvey

Yeah it definitely shouldn’t require everything to be manually deleted each time. I’d take a look at the aws SAM docs and walk through some of the examples there to see what might be going wrong.

docs.aws.amazon.com/serverless-app...

docs.aws.amazon.com/serverless-app...

Thread Thread
 
thissayantan profile image
Sayantan

Thanks a lot. 👍👍