Bash Lamba更新后脚本发布提示

Bash script release prompt after Lamba update

AWS Lambda bash 部署脚本:

01 #!/usr/bin/env bash
02 cp package.json ./dist
03 cp -a ./env/ ./dist/env
04 cd ./dist
05 npm install --silent --only=prod
06 zip -q -r ../function.zip .
07 cd ../
08 aws lambda update-function-code --function-name $FUNCTION_NAME --zip-file fileb://function.zip
09 rm ./function.zip

上面的脚本工作正常,但是,在 L08 aws lambda update-function-code 步骤后提示没有释放,相反,我在文本文件中看到 AWS CLI 的输出并且提示只是挂起(必须按 Q 退出)。

{
    "FunctionName": "foo",
    "FunctionArn": "arn:aws:lambda:xxx:xxxx:function:xxx",
    "Runtime": "nodejs14.x",
    "Role": "arn:aws:iam::xxx:role/xxxxxxxx",
    "Handler": "index.handler",
    "CodeSize": 24471144,
    "Description": "",
    "Timeout": 3,
    "MemorySize": 128,
    "LastModified": "2022-01-27T23:38:54.000+0000",
    "CodeSha256": "frtAS71k17XuXNB1xQUTyaBsTcE/8aBUWoBgpGrfFYA=",
    "Version": "$LATEST",
    "TracingConfig": {
        "Mode": "PassThrough"
    },
    "RevisionId": "61ea91d6-9e85-4aa1-93e1-0784c359f5b4",
    "State": "Active",
    "LastUpdateStatus": "InProgress",
    "LastUpdateStatusReason": "The function is being created.",
    "LastUpdateStatusReasonCode": "Creating",
    "Architectures": [
        "x86_64"
    ]
}

脚本似乎卡在了里面 VIM?我如何退出并进行下一步?

您的问题似乎是由 AWS Command-Line Interface (CLI) 引起的,它有一个 pager。您可以通过将此附加到您的 aws 命令来关闭寻呼机:--no-paginate

或者,将这些行放在 ~/.aws/config 文件中:

[default]
cli_pager=

有关详细信息,请参阅:Using AWS CLI pagination options - AWS Command Line Interface