Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash script release prompt after Lamba update

AWS Lambda bash deploy script:

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

The above script works fine, however, the prompt is not released after L08 aws lambda update-function-code step, instead, I see the output from AWS CLI in a text file and the prompt just hangs (must press Q to quit).

{
    "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"
    ]
}

It seems the script gets stuck inside VIM? How do I get out and proceed to the next step?

like image 247
ChrisRich Avatar asked Feb 21 '26 03:02

ChrisRich


1 Answers

Your issue seems to be caused by the AWS Command-Line Interface (CLI), which has a pager. You can turn off the pager by appending this to your aws command: --no-paginate

Alternatively, put these lines in the ~/.aws/config file:

[default]
cli_pager=

For more information, see: Using AWS CLI pagination options - AWS Command Line Interface

like image 104
John Rotenstein Avatar answered Feb 22 '26 15:02

John Rotenstein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!