amazon-web-services - 如何在 aws lambda cutom RunTime (Shell) 中使用 aws cli 二进制文件
问题描述
无法在 Lambda 自定义运行时运行 AWS CLI,出现错误:
未找到 aws 命令
python3 -m venv lambdaVirtualEnv
source activate lambdaVirtualEnv
pip3 install awscli
copied the aws binary and contents under the site-packages to lambdaLayerDir
Created a lambda layer using lambdaLayerDir.zip file.
function handler ()
{
PATH=${PATH}:${LAMBDA_TASK_ROOT}
echo $PATH
EVENT_DATA=$1
RESPONSE="{\"statusCode\": 200, \"body\": \"Hello from Lambda!\"}"
echo $RESPONSE
aws
}
输出:
> * Connection #0 to host 127.0.0.1 left intact
/var/task/hello.sh: line 9: aws: command not found
END RequestId: b2225b95-c53c-4271-a664-873dc19528b4
REPORT RequestId: b2225b95-c53c-4271-a664-873dc19528b4 Init Duration: 33.70 ms Duration: 431.44 ms Billed Duration: 500 ms Memory Size: 128 MB Max Memory Used: 45 MB
RequestId: b2225b95-c53c-4271-a664-873dc19528b4 Error: Runtime exited with error: exit status 127
Runtime.ExitError
解决方案
推荐阅读
- c# - .NET MongoDB:从 BsonType 数组反序列化 BsonDocument
- vb.net - 在 Visio 中使用 Shape.SetFormulas 时出现 ShapeSheet 单元格引用错误
- python - 在循环中有两个 subplot2grid
- python - Flask登录sqlite3数据库身份验证
- python - 基于某些属性合并对象并组合(求和)某些其他属性
- json - Swift - 调用中缺少参数标签“where:”但修复导致“无法将 Bool 类型的值转换为预期”错误
- java - 3D井字游戏的启发式
- react-native - 使用导航参数设置 redux 状态
- bash - 捕获并重试 bash
- spring-boot - Spring boot 多模块项目多数据源