LoginSignup
1
0

More than 1 year has passed since last update.

AWS Lambdaでコンテナ(インスタンス)を再利用させないようにする

Last updated at Posted at 2023-02-23

Lambdaは前回実行から310秒以内に実行するとコンテナを再利用します。sleepさせて意図的に再利用できないようにできます。汚れた環境で実行したくない場合に便利です

検証方法

sleep 320にするとログストリームが増え、新しいコンテナ(インスタンス)で実行されていることがあわります

for i in `seq 10`; do curl https://.lambda-url.ap-northeast-1.on.aws/; sleep 320; done

image.png

sleep 300にするとログストリームが増えず、1つのコンテナ(インスタンス)で実行されていることがあわります

for i in `seq 10`; do curl https://.lambda-url.ap-northeast-1.on.aws/; sleep 300; done

image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0