强制丢弃AWS Lambda容器 [英] Force Discard AWS Lambda Container

查看:81
本文介绍了强制丢弃AWS Lambda容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何出于开发和测试目的,使用aws控制台或aws cli手动在集群中强制放弃aws lambda函数?

How to manually forcefully discard a aws lambda function in the cluster using aws console or aws cli for development and testing purposes ?

推荐答案

如果重新部署该函数,它将终止所有现有容器.可以简单地将当前日期/时间分配给Lambda函数的描述并重新部署.这将使您可以根据需要重新部署许多次,因为某些东西是唯一的,并且每次执行部署时都会拆除所有现有的容器.

If you redeploy the function it'll terminate all existing containers. It could be as simple as assigning the current date/time to the description of the Lambda function and redeploying. This will allow you to redeploy as many times as you need because something is unique and it will tear down all existing containers each time you do the deployment.

话虽如此,Lambda函数应该是无状态的.在编写代码时,请牢记这一点(例如,避免使用全局变量,如果创建临时文件,则使用随机文件名,等等).从事情的声音来看,我认为如果您需要拆除Lambda容器,则可能会对您的设计产生影响.

With that said, Lambda functions are supposed to be stateless. You should keep that in mind when you write your code (eg. avoid using global variables, use random file names if creating something temp, etc). From the sounds of things, I think you might have an issue with your design if you require the Lambda container to be torn down.

这篇关于强制丢弃AWS Lambda容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆