Python/AWS Lambda函数:如何查看/tmp存储?
Lambda函数可以访问其自己的/tmp
目录中的磁盘空间.我的问题是,在哪里可以直观地查看/tmp
目录?
Lambda functions have access to disk space in their own /tmp
directories. My question is, where can I visually view the /tmp
directory?
我正尝试将文件下载到/tmp
目录中以进行读取,并向其中写入新文件.我实际上希望看到正在使用的文件在执行期间正确存储在/tmp
中.
I’m attempting to download the files into the /tmp
directory to read them, and write a new file to it as well. I actually want see the files I’m working with are getting stored properly in /tmp
during execution.
谢谢
lambda执行结束后,您将无法查看"/tmp目录.
You can't 'view' the /tmp directory after the lambda execution has ended.
Lambda在分布式体系结构中工作,执行后,所有使用的资源(包括存储在/tmp
中的所有文件)都将被处置.
Lambda works in distributed architecture and after the execution all resources used (including all files stored in /tmp
) are disposed.
因此,如果您要检查文件,则可能需要考虑使用EC2或S3.
So if you want to check your files, you might want consider using EC2 or S3.
如果只想检查s3下载是否成功,则可以在执行过程中尝试:
If you just want to check if the s3 download was successful, during the execution, you can try:
import os
os.path.isfile('/tmp/' + filename)