Home > Mobile >  Avoid AWS CLI to wait on --More-- prompt
Avoid AWS CLI to wait on --More-- prompt

Time:11-28

I am automating app deployments by making use of AWS CLI commands. However, the problem is that when the AWS command is fired and is completed, the next command in the script is not executed. This is because the command returns a JSON and that JSON doesn't display whole at a time. It displays partial and then a --More-- prompt appears. Only when the user presses Enter (or may be any other key), then only the rest of the JSON is displayed. If the JSON returned is large, this process (of pressing Enter) is to be repeated many times.

Example:

aws lambda create-function --function-name testFunction --zip-file fileb://testFunction.zip --handler testFunction.lambda_handler --runtime python3.9 --role arn:aws:iam::413124763983:role/LambdaAccessRole\n\n
{
    "FunctionName": "testFunction",
    "FunctionArn": "arn:aws:lambda:us-east-1:413124763983:function:testFunction",
    "Runtime": "python3.9",
    "Role": "arn:aws:iam::413124763983:role/LambdaAccessRole",
    "Handler": "testFunction.lambda_handler",
    "CodeSize": 986,
    "Description": "",
    "Timeout": 3,
    "MemorySize": 128,
    "LastModified": "2022-11-28T03:39:11.017 0000",
    "CodeSha256": "moRVatK9khJOLTbPzq8zrGB989nBhfMiV1GCx5pNr2o=",
    "Version": "$LATEST",
-- More --

As can be seen above, there is a --More-- prompt at after partial JSON is displayed.

How can I avoid this --More-- prompt and simply display entire JSON so that next command in the script is executed?

CodePudding user response:

You can disable the pager using

AWS_PAGER= aws lambda create-function ...

CodePudding user response:

From Using AWS CLI pagination options - AWS Command Line Interface:

The following example sets the default to disable the use of a pager:

[default]
cli_pager=

This should go in your ~/.aws/config file.

  • Related